Field
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
Regular field construction should happen through the field mapper.
Returns the ID of the content type.
Returns the name of the content type.
Returns the type of the field.
If the field is a link, this will return the type of the linked resource.
Returns true if this field is required.
Returns true if the field contains locale dependent content.
True if the field is disabled.
If the field is an array, this returns the type of its items.
If the field is an array, and it's items are links, this returns the type of the linked resources.
{@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.
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.
at line 135
string
getName()
Returns the name of the content type.
This is a human friendly name shown to the user.
at line 156
string
getType()
Returns the type of the field.
Possible values are: - Symbol - Text - Integer - Number - Date - Boolean - Link - Array - Object
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
at line 180
bool
isRequired()
Returns true if this field is required.
at line 190
bool
isLocalized()
Returns true if the field contains locale dependent content.
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.
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
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
at line 244
jsonSerialize()
{@inheritdoc}