Skip to content

FieldTrait ​

Type
Trait
Namespace
craft\base
Implemented by
craft\base\Field, craft\fields\Addresses, craft\fields\Assets, craft\fields\BaseOptionsField, craft\fields\BaseRelationField, craft\fields\Categories, craft\fields\Checkboxes, craft\fields\Color, craft\fields\Country, craft\fields\Date, craft\fields\Dropdown, craft\fields\Email, craft\fields\Entries, craft\fields\Icon, craft\fields\Lightswitch, craft\fields\Link, craft\fields\Matrix, craft\fields\MissingField, craft\fields\Money, craft\fields\MultiSelect, craft\fields\Number, craft\fields\PlainText, craft\fields\RadioButtons, craft\fields\Table, craft\fields\Tags, craft\fields\Time, craft\fields\Users
Since
3.0.0

FieldTrait implements the common methods and properties for field classes.

View source

Public Properties ​

PropertyDescription
columnSuffixstring, null – The field’s content column suffix
contextstring, null – The field’s context
dateDeletedDateTime, null – The date that the field was trashed
describedBystring, null – The aria-describedby attribute value that should be set on the focusable input(s).
handlestring, null – The field’s handle
instructionsstring, null – The field’s instructions
layoutElementcraft\fieldlayoutelements\CustomField, null – The field layout element
namestring, null – The field’s name
oldHandlestring, null – The field’s previous handle
oldSettingsarray, null – The field’s previous settings
requiredboolean, null – Whether the field is required in the field layout it was fetched from
searchableboolean – Whether the field's values should be registered as search keywords on the elements.
translationKeyFormatstring, null – The field’s translation key format, if translationMethod is "custom"
translationMethodstring – The field’s translation method
uidstring, null – The field's UID

columnSuffix ​

DEPRECATED

Deprecated in 5.0.0

Type
string, null
Default value
null
Since
3.7.0

The field’s content column suffix

View source

context ​

Type
string, null
Default value
null

The field’s context

View source

dateDeleted ​

Type
DateTime, null
Default value
null
Since
5.3.0

The date that the field was trashed

View source

describedBy ​

Type
string, null
Default value
null
Since
3.7.24

The aria-describedby attribute value that should be set on the focusable input(s).

See also craft\base\FieldInterface::getInputHtml()

View source

handle ​

Type
string, null
Default value
null

The field’s handle

View source

instructions ​

Type
string, null
Default value
null

The field’s instructions

View source

layoutElement ​

Type
craft\fieldlayoutelements\CustomField, null
Default value
null
Since
5.0.0

The field layout element

View source

name ​

Type
string, null
Default value
null

The field’s name

View source

oldHandle ​

Type
string, null
Default value
null

The field’s previous handle

View source

oldSettings ​

Type
array, null
Default value
null
Since
3.1.2

The field’s previous settings

View source

required ​

DEPRECATED

Deprecated in 4.1.4. craft\fieldlayoutelements\BaseField::$required should be used instead

Type
boolean, null
Default value
null

Whether the field is required in the field layout it was fetched from

View source

searchable ​

Type
boolean
Default value
false

Whether the field's values should be registered as search keywords on the elements.

View source

translationKeyFormat ​

Type
string, null
Default value
null

The field’s translation key format, if translationMethod is "custom"

View source

translationMethod ​

Type
string
Default value
\craft\base\Field::TRANSLATION_METHOD_NONE

The field’s translation method

View source

uid ​

Type
string, null
Default value
null

The field's UID

View source