ContentType
class ContentType extends BaseResource implements ContentTypeInterface, CreatableInterface
ContentType class.
This class represents a resource with type "ContentType" in Contentful.
Traits
Properties
protected ContentType | $sys | ||
Client | $client | from UpdatableTrait | |
protected string | $name | ||
protected string|null | $description | ||
protected string|null | $displayField | ||
protected FieldInterface[] | $fields | ||
protected bool | $isPublished |
Methods
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}
Returns a ContentTypeSnapshot resource.
Returns a ResourceArray object which contains ContentTypeSnapshot resources.
Returns an EditorInterface resource.
{@inheritdoc}
ContentType constructor.
{@inheritdoc}
Returns an associative array where keys are the name of the fragments in a URI, and the values are the corresponding IDs.
Returns an array of headers that the current resource needs to sent for being created.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Adds a new content type field, and returns it.
Shortcut for creating a new field object.
Details
in BaseResource at line 37
getId()
{@inheritdoc}
in BaseResource at line 45
getType()
{@inheritdoc}
in BaseResource at line 53
asLink()
{@inheritdoc}
in UpdatableTrait at line 35
abstract mixed
asRequestBody()
Returns the resource in the form of request body.
This can differ from regular serialization, as some fields may not be present in the request payload.
in BaseResource at line 79
BaseResource
setClient(Client $client)
Sets the current Client object instance.
This is done automatically when performing API calls, so it shouldn't be used manually.
at line 131
protected
getSpaceId()
{@inheritdoc}
at line 139
protected
getEnvironmentId()
{@inheritdoc}
at line 147
protected
getContentTypeId()
{@inheritdoc}
in ContentTypeProxyExtension at line 61
ContentTypeSnapshot
getSnapshot(string $snapshotId)
Returns a ContentTypeSnapshot resource.
in ContentTypeProxyExtension at line 80
ResourceArray
getSnapshots(Query $query = \null)
Returns a ResourceArray object which contains ContentTypeSnapshot resources.
in ContentTypeProxyExtension at line 97
EditorInterface
getEditorInterface()
Returns an EditorInterface resource.
in DeletableTrait at line 28
delete()
Deletes the current resource.
in PublishableTrait at line 31
publish()
Publishes the current resource.
in PublishableTrait at line 41
unpublish()
Unpublishes the current resource.
at line 81
getSystemProperties()
{@inheritdoc}
in UpdatableTrait at line 40
update()
Updates the current resource.
at line 73
__construct(string $name)
ContentType constructor.
at line 89
jsonSerialize()
{@inheritdoc}
at line 111
string[]
asUriParameters()
Returns an associative array where keys are the name of the fragments in a URI, and the values are the corresponding IDs.
at line 123
string[]
getHeadersForCreation()
Returns an array of headers that the current resource needs to sent for being created.
This method is supposed to be overridden if necessary.
at line 155
string
getName()
at line 165
ContentType
setName(string $name)
at line 175
string|null
getDescription()
at line 185
ContentType
setDescription(string $description = \null)
at line 195
string|null
getDisplayField()
at line 205
ContentType
setDisplayField(string $displayField = \null)
at line 215
FieldInterface[]
getFields()
at line 227
FieldInterface
getField(string $fieldId)
at line 247
ContentType
setFields(array $fields)
at line 259
ContentType
addField(FieldInterface $contentTypeField)
at line 269
bool
isPublished()
at line 284
FieldInterface
addNewField(string $type, string $fieldId, string $name, array $params)
Adds a new content type field, and returns it.
at line 302
FieldInterface
createField(string $type, string $fieldId, string $name, array $params)
Shortcut for creating a new field object.