Craft 3 Class Reference

Trait craft\base\FieldTrait

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\Date, craft\fields\Dropdown, craft\fields\Email, craft\fields\Entries, 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\Tags, craft\fields\Url, craft\fields\Users
Available since version
3.0
Source Code
https://github.com/craftcms/cms/blob/master/src/base/FieldTrait.php

FieldTrait implements the common methods and properties for field classes.

Public Properties
Property Type Description Defined By
$columnPrefix string, null The field’s content column prefix craft\base\FieldTrait
$context string, null The field’s context craft\base\FieldTrait
$groupId integer, null The field’s group’s ID craft\base\FieldTrait
$handle string, null The field’s handle craft\base\FieldTrait
$instructions string, null The field’s instructions craft\base\FieldTrait
$layoutId integer, null The ID of the field layout that the field was fetched from craft\base\FieldTrait
$name string, null The field’s name craft\base\FieldTrait
$oldHandle string, null The field’s previous handle craft\base\FieldTrait
$required boolean, null Whether the field is required in the field layout it was fetched from craft\base\FieldTrait
$sortOrder integer, null The field’s sort position in the field layout it was fetched from craft\base\FieldTrait
$tabId integer, null The tab ID of the field layout that the field was fetched from craft\base\FieldTrait
$translationKeyFormat string, null The field’s translation key format, if $translationMethod is "custom" craft\base\FieldTrait
$translationMethod string The field’s translation method craft\base\FieldTrait

Property Details

$columnPrefix public property #

The field’s content column prefix

public string, null $columnPrefix null

$context public property #

The field’s context

public string, null $context null

$groupId public property #

The field’s group’s ID

public integer, null $groupId null

$handle public property #

The field’s handle

public string, null $handle null

$instructions public property #

The field’s instructions

public string, null $instructions null

$layoutId public property #

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

public integer, null $layoutId null

$name public property #

The field’s name

public string, null $name null

$oldHandle public property #

The field’s previous handle

public string, null $oldHandle null

$required public property #

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

public boolean, null $required null

$sortOrder public property #

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

public integer, null $sortOrder null

$tabId public property #

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

public integer, null $tabId null

$translationKeyFormat public property #

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

public string, null $translationKeyFormat null

$translationMethod public property #

The field’s translation method

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