class ContentType extends BaseResource

Content Types are schemas that define the fields of Entries. Every Entry can only contain values in the fields defined by its Content Type, and the values of those fields must match the data type defined in the Content Type.

Properties

protected Client $client from BaseResource
protected SystemProperties $sys from BaseResource
protected string $name Name of the Content Type.
protected string|null $description Description of the Content Type.
protected Field[] $fields The fields, keyed by ID.
protected string|null $displayField ID of main field used for display.

Methods

__construct(array $data)

Resources in this SDK should not be built using $new Class().

asLink()

{@inheritdoc}

getId()

{@inheritdoc}

getType()

{@inheritdoc}

getSpace()

Returns the space this content type belongs to.

getEnvironment()

Returns the environment this content type belongs to.

string
getName()

Returns the name of this content type.

Field[]
getFields()

Returns all the fields of this content type as an associative array. The key is the ID of the field.

string|null
getDescription()

Returns the content type's description.

Field|null
getField(string $fieldId, bool $tryCaseInsensitive = false)

Returns the field for the passed id.

Field|null
getDisplayField()

Returns the the display field of a content type. Commonly this is the title.

addUnknownField(string $name)

Adds a runtime field, of type unknown.

jsonSerialize()

{@inheritdoc}

Details

in BaseResource at line 36
protected __construct(array $data)

Resources in this SDK should not be built using $new Class().

This method is only useful in testing environments, where the resource needs to be subclasses and this method made public.

Parameters

array $data

in BaseResource at line 50
SystemProperties getSystemProperties()

{@inheritdoc}

Return Value

SystemProperties

{@inheritdoc}

in BaseResource at line 69
getId()

{@inheritdoc}

in BaseResource at line 77
getType()

{@inheritdoc}

at line 53
Space getSpace()

Returns the space this content type belongs to.

Return Value

Space

at line 63
Environment|null getEnvironment()

Returns the environment this content type belongs to.

Return Value

Environment|null

at line 73
string getName()

Returns the name of this content type.

Return Value

string

at line 83
Field[] getFields()

Returns all the fields of this content type as an associative array. The key is the ID of the field.

Return Value

Field[]

at line 93
string|null getDescription()

Returns the content type's description.

Return Value

string|null

at line 108
Field|null getField(string $fieldId, bool $tryCaseInsensitive = false)

Returns the field for the passed id.

If the field does not exist, null is returned.

Parameters

string $fieldId
bool $tryCaseInsensitive

Return Value

Field|null

at line 132
Field|null getDisplayField()

Returns the the display field of a content type. Commonly this is the title.

Returns null if not display field is set.

Return Value

Field|null

at line 148
Field addUnknownField(string $name)

Adds a runtime field, of type unknown.

Parameters

string $name

Return Value

Field

at line 158
jsonSerialize()

{@inheritdoc}