class Field implements JsonSerializable

A Field describes one field of a ContentType.

This includes essential information for the display of the field's value.

Properties

protected string $id ID of the Field.
protected string $name Name of the Field.
protected string $type Type of the Field.
protected string|null $linkType Type of the linked resource.
protected string|null $itemsType (Array type only) Type for items.
protected string|null $itemsLinkType (Array of links only) Type of links.
protected bool $required Describes whether the Field is mandatory.
protected bool $localized Describes whether the Field is localized.
protected bool $disabled Describes whether the Field is disabled.

Methods

__construct(string $id, string $name, string $type)

Regular field construction should happen through the field mapper.

getId()

Returns the ID of the field.

getName()

Returns the name of the field.

getType()

Returns the type of the field.

string|null
getLinkType()

If the field is a link, this will return the type of the linked resource.

isRequired()

Returns true if this field is required.

isLocalized()

Returns true if the field contains locale dependent content.

isDisabled()

True if the field is disabled.

string|null
getItemsType()

If the field is an array, this returns the type of its items.

string|null
getItemsLinkType()

If the field is an array, and it's items are links, this returns the type of the linked resources.

jsonSerialize()

{@inheritdoc}

Details

at line 107
__construct(string $id, string $name, string $type)

Regular field construction should happen through the field mapper.

This here is a special exception needed for when building fields on type "Unknown", in the edge case of cache being out of sync with the API.

Parameters

string $id
string $name
string $type

at line 118
getId()

Returns the ID of the field.

This is the internal identifier of the content type and is unique in the space.

at line 127
getName()

Returns the name of the field.

This is a human friendly name shown to the user.

at line 147
getType()

Returns the type of the field.

Possible values are: - Symbol - Text - Integer - Number - Date - Boolean - Link - Array - Object - Location

at line 161
string|null getLinkType()

If the field is a link, this will return the type of the linked resource.

Possible values are: - Asset - Entry

Return Value

string|null

at line 169
isRequired()

Returns true if this field is required.

at line 177
isLocalized()

Returns true if the field contains locale dependent content.

at line 187
isDisabled()

True if the field is disabled.

Disabled fields are part of the API responses but not accessible trough the PHP SDK.

at line 201
string|null getItemsType()

If the field is an array, this returns the type of its items.

Possible values are: - Symbol - Link

Return Value

string|null

at line 215
string|null getItemsLinkType()

If the field is an array, and it's items are links, this returns the type of the linked resources.

Possible values are: - Asset - Entry

Return Value

string|null

at line 223
jsonSerialize()

{@inheritdoc}