class ContentType extends BaseResource implements Creatable, Updatable, Deletable, Publishable

ContentType class.

This class represents a resource with type "ContentType" in Contentful.

Properties

protected SystemProperties $sys from BaseResource
protected BaseProxy $proxy from BaseResource
protected string $name
protected string|null $description
protected string|null $displayField
protected FieldInterface[] $fields
protected bool $isPublished

Methods

__construct(string $name)

ContentType constructor.

getSystemProperties()

Returns the resource's system properties, defined in the object "sys" in Contentful's responses.

string|null
getId()

Shortcut for accessing the resource ID through its system properties.

Link
asLink()

Creates a Link representation of the current resource.

setProxy(BaseProxy $proxy)

Sets the current BaseProxy object instance.

asRequestBody()

{@inheritdoc}

__call(string $name, array $arguments)

Shortcut for forwarding methods to the current proxy, using the current object as argument.

string
getName()

No description

setName(string $name = null)

No description

string|null
getDescription()

No description

setDescription(string $description = null)

No description

string|null
getDisplayField()

No description

setDisplayField(string $displayField = null)

No description

getFields()

No description

getField(string $fieldId)

No description

setFields(array $fields)

No description

addField(FieldInterface $contentTypeField)

No description

bool
isPublished()

No description

array
jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

Details

at line 58
__construct(string $name)

ContentType constructor.

Parameters

string $name

in BaseResource at line 47
SystemProperties getSystemProperties()

Returns the resource's system properties, defined in the object "sys" in Contentful's responses.

Return Value

SystemProperties

in BaseResource at line 57
string|null getId()

Shortcut for accessing the resource ID through its system properties.

Return Value

string|null

Creates a Link representation of the current resource.

Return Value

Link

in BaseResource at line 79
BaseResource setProxy(BaseProxy $proxy)

Sets the current BaseProxy object instance.

This is done automatically when performing API calls, so it shouldn't be used manually.

Parameters

BaseProxy $proxy

Return Value

BaseResource

in BaseResource at line 89
asRequestBody()

{@inheritdoc}

in BaseResource at line 111
__call(string $name, array $arguments)

Shortcut for forwarding methods to the current proxy, using the current object as argument.

// Instead of
$client->asset->publish($asset);
// You can use
$asset->publish();

Parameters

string $name
array $arguments

at line 67
string getName()

Return Value

string

at line 77
ContentType setName(string $name = null)

Parameters

string $name

Return Value

ContentType

at line 87
string|null getDescription()

Return Value

string|null

at line 97
ContentType setDescription(string $description = null)

Parameters

string $description

Return Value

ContentType

at line 107
string|null getDisplayField()

Return Value

string|null

at line 117
ContentType setDisplayField(string $displayField = null)

Parameters

string $displayField

Return Value

ContentType

at line 127
FieldInterface[] getFields()

Return Value

FieldInterface[]

at line 139
FieldInterface getField(string $fieldId)

Parameters

string $fieldId

Return Value

FieldInterface

Exceptions

InvalidArgumentException

at line 159
ContentType setFields(array $fields)

Parameters

array $fields

Return Value

ContentType

at line 171
ContentType addField(FieldInterface $contentTypeField)

Parameters

FieldInterface $contentTypeField

Return Value

ContentType

at line 181
bool isPublished()

Return Value

bool

at line 191
array jsonSerialize()

Returns an array to be used by "json_encode" to serialize objects of this class.

Return Value

array