FieldTrait ​
- Type
- Trait
- Namespace
- craft\base
- Implemented by
- craft\base\Field, 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\Lightswitch, 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\Url, craft\fields\Users
- Since
- 3.0.0
FieldTrait implements the common methods and properties for field classes.
Public Properties ​
| Property | Description |
|---|---|
| columnPrefix | string, null – The field’s content column prefix |
| columnSuffix | string, null – The field’s content column suffix |
| context | string, null – The field’s context |
| describedBy | string, null – The aria-describedby attribute value that should be set on the focusable input(s). |
| groupId | integer, null – The field’s group’s ID |
| handle | string, null – The field’s handle |
| instructions | string, null – The field’s instructions |
| layoutId | integer, null – The ID of the field layout that the field was fetched from |
| name | string, null – The field’s name |
| oldHandle | string, null – The field’s previous handle |
| oldSettings | array, null – The field’s previous settings |
| required | boolean, null – Whether the field is required in the field layout it was fetched from |
| searchable | boolean – Whether the field's values should be registered as search keywords on the elements. |
| sortOrder | integer, null – The field’s sort position in the field layout it was fetched from |
| tabId | integer, null – The tab ID of the field layout that the field was fetched from |
| translationKeyFormat | string, null – The field’s translation key format, if translationMethod is "custom" |
| translationMethod | string – The field’s translation method |
| uid | string, null – The field's UID |
columnPrefix ​
The field’s content column prefix
columnSuffix ​
The field’s content column suffix
context ​
The field’s context
describedBy ​
The aria-describedby attribute value that should be set on the focusable input(s).
See also craft\base\FieldInterface::getInputHtml()
groupId ​
The field’s group’s ID
handle ​
The field’s handle
instructions ​
The field’s instructions
layoutId ​
The ID of the field layout that the field was fetched from
name ​
The field’s name
oldHandle ​
The field’s previous handle
oldSettings ​
The field’s previous settings
required ​
DEPRECATED
Deprecated in 4.1.4. craft\fieldlayoutelements\BaseField::$required should be used instead
Whether the field is required in the field layout it was fetched from
searchable ​
- Type
- boolean
- Default value
false
Whether the field's values should be registered as search keywords on the elements.
sortOrder ​
The field’s sort position in the field layout it was fetched from
tabId ​
The tab ID of the field layout that the field was fetched from
translationKeyFormat ​
The field’s translation key format, if translationMethod is "custom"
translationMethod ​
- Type
- string
- Default value
\craft\base\Field::TRANSLATION_METHOD_NONE
The field’s translation method
uid ​
The field's UID