ContentType
class ContentType extends BaseResource implements CreatableInterface
ContentType class.
This class represents a resource with type "ContentType" in Contentful.
Traits
Properties
SystemProperties | $sys | from UpdatableTrait | |
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.
ContentType constructor.
Returns an array to be used by "json_encode" to serialize objects of this class.
Returns an associate 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 39
protected
initialize(string $type, array $sys = [])
Initialize system properties.
in BaseResource at line 48
getSystemProperties()
{@inheritdoc}
in BaseResource at line 56
getId()
{@inheritdoc}
in BaseResource at line 64
getType()
{@inheritdoc}
in BaseResource at line 72
asLink()
{@inheritdoc}
in UpdatableTrait at line 33
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 98
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 118
protected
getSpaceId()
{@inheritdoc}
at line 126
protected
getEnvironmentId()
{@inheritdoc}
at line 134
protected
getContentTypeId()
{@inheritdoc}
in ContentTypeProxyExtension at line 60
ContentTypeSnapshot
getSnapshot(string $snapshotId)
Returns a ContentTypeSnapshot resource.
in ContentTypeProxyExtension at line 79
ResourceArray
getSnapshots(Query $query = null)
Returns a ResourceArray object which contains ContentTypeSnapshot resources.
in ContentTypeProxyExtension at line 96
EditorInterface
getEditorInterface()
Returns an EditorInterface resource.
in DeletableTrait at line 29
delete()
Deletes the current resource.
in PublishableTrait at line 29
publish()
Publishes the current resource.
in PublishableTrait at line 39
unpublish()
Unpublishes the current resource.
in UpdatableTrait at line 38
update()
Deletes the current resource.
at line 65
__construct(string $name)
ContentType constructor.
at line 76
array
jsonSerialize()
Returns an array to be used by "json_encode" to serialize objects of this class.
at line 98
string[]
asUriParameters()
Returns an associate array where keys are the name of the fragments in a URI, and the values are the corresponding IDs.
at line 110
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 142
string
getName()
at line 152
ContentType
setName(string $name = null)
at line 162
string|null
getDescription()
at line 172
ContentType
setDescription(string $description = null)
at line 182
string|null
getDisplayField()
at line 192
ContentType
setDisplayField(string $displayField = null)
at line 202
FieldInterface[]
getFields()
at line 214
FieldInterface
getField(string $fieldId)
at line 234
ContentType
setFields(array $fields)
at line 246
ContentType
addField(FieldInterface $contentTypeField)
at line 256
bool
isPublished()
at line 271
FieldInterface
addNewField(string $type, string $fieldId, string $name, mixed $params)
Adds a new content type field, and returns it.
at line 289
FieldInterface
createField(string $type, string $fieldId, string $name, mixed $params)
Shortcut for creating a new field object.