FieldTrait

Type
Trait
Namespace
craft\base
Implemented by
craft\base\Field, craft\fields\BaseOptionsField, craft\fields\Checkboxes, craft\fields\Color, craft\fields\Date, craft\fields\Dropdown, craft\fields\Email, craft\fields\Lightswitch, craft\fields\Matrix, craft\fields\MissingField, craft\fields\MultiSelect, craft\fields\Number, craft\fields\PlainText, craft\fields\RadioButtons, craft\fields\Table, craft\fields\Url
Since
3.0

FieldTrait implements the common methods and properties for field classes.

View source

Public Properties

PropertyDescription
$columnPrefixstring, null – The field’s content column prefix
$contextstring, null – The field’s context
$groupIdinteger, null – The field’s group’s ID
$handlestring, null – The field’s handle
$instructionsstring, null – The field’s instructions
$layoutIdinteger, null – The ID of the field layout that the field was fetched from
$namestring, null – The field’s name
$oldHandlestring, null – The field’s previous handle
$requiredboolean, null – Whether the field is required in the field layout it was fetched from
$sortOrderinteger, null – The field’s sort position in the field layout it was fetched from
$tabIdinteger, null – The tab ID of the field layout that the field was fetched from
$translationKeyFormatstring, null – The field’s translation key format, if $translationMethod is "custom"
$translationMethodstring – The field’s translation method

$columnPrefix

Type
string, null

The field’s content column prefix

View source

Signature

public string, null $columnPrefix = null

$context

Type
string, null

The field’s context

View source

Signature

public string, null $context = null

$groupId

Type
integer, null

The field’s group’s ID

View source

Signature

public integer, null $groupId = null

$handle

Type
string, null

The field’s handle

View source

Signature

public string, null $handle = null

$instructions

Type
string, null

The field’s instructions

View source

Signature

public string, null $instructions = null

$layoutId

Type
integer, null

The ID of the field layout that the field was fetched from

View source

Signature

public integer, null $layoutId = null

$name

Type
string, null

The field’s name

View source

Signature

public string, null $name = null

$oldHandle

Type
string, null

The field’s previous handle

View source

Signature

public string, null $oldHandle = null

$required

Type
boolean, null

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

View source

Signature

public boolean, null $required = null

$sortOrder

Type
integer, null

The field’s sort position in the field layout it was fetched from

View source

Signature

public integer, null $sortOrder = null

$tabId

Type
integer, null

The tab ID of the field layout that the field was fetched from

View source

Signature

public integer, null $tabId = null

$translationKeyFormat

Type
string, null

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

View source

Signature

public string, null $translationKeyFormat = null

$translationMethod

Type
string

The field’s translation method

View source

Signature

public string $translationMethod = \craft\base\Field::TRANSLATION_METHOD_NONE