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.

string
getId()

Returns the ID of the content type.

string
getName()

Returns the name of the content type.

string
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.

bool
isRequired()

Returns true if this field is required.

bool
isLocalized()

Returns true if the field contains locale dependent content.

bool
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 109
__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 123
string getId()

Returns the ID of the content type.

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

Return Value

string

at line 135
string getName()

Returns the name of the content type.

This is a human friendly name shown to the user.

Return Value

string

at line 156
string getType()

Returns the type of the field.

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

Return Value

string

at line 170
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 180
bool isRequired()

Returns true if this field is required.

Return Value

bool

at line 190
bool isLocalized()

Returns true if the field contains locale dependent content.

Return Value

bool

at line 202
bool isDisabled()

True if the field is disabled.

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

Return Value

bool

at line 222
string|null getItemsType()

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

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

Return Value

string|null

at line 236
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 244
jsonSerialize()

{@inheritdoc}