class FieldType

Same name in this branch
  1. 9 core/modules/field/src/Plugin/migrate/process/FieldType.php \Drupal\field\Plugin\migrate\process\FieldType
Same name in other branches
  1. 8.9.x core/modules/field/src/Plugin/migrate/process/FieldType.php \Drupal\field\Plugin\migrate\process\FieldType
  2. 8.9.x core/lib/Drupal/Core/Field/Annotation/FieldType.php \Drupal\Core\Field\Annotation\FieldType
  3. 10 core/modules/field/src/Plugin/migrate/process/FieldType.php \Drupal\field\Plugin\migrate\process\FieldType
  4. 10 core/lib/Drupal/Core/Field/Annotation/FieldType.php \Drupal\Core\Field\Annotation\FieldType
  5. 11.x core/modules/field/src/Plugin/migrate/process/FieldType.php \Drupal\field\Plugin\migrate\process\FieldType
  6. 11.x core/lib/Drupal/Core/Field/Annotation/FieldType.php \Drupal\Core\Field\Annotation\FieldType
  7. 11.x core/lib/Drupal/Core/Field/Attribute/FieldType.php \Drupal\Core\Field\Attribute\FieldType
  8. 10 core/lib/Drupal/Core/Field/Attribute/FieldType.php \Drupal\Core\Field\Attribute\FieldType

Defines a FieldType annotation object.

Additional annotation keys for field types can be defined in hook_field_info_alter().

Hierarchy

Expanded class hierarchy of FieldType

Related topics

50 classes are annotated with FieldType
AutoIncrementingTestItem in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/AutoIncrementingTestItem.php
Defines the 'field_method_invocation_order_test' entity field type.
BooleanItem in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
Defines the 'boolean' entity field type.
ChangedItem in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/ChangedItem.php
Defines the 'changed' entity field type.
ChangedTestItem in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ChangedTestItem.php
Defines the 'changed_test' entity field type.
CommentItem in core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php
Plugin implementation of the 'comment' field type.

... See full list

File

core/lib/Drupal/Core/Field/Annotation/FieldType.php, line 17

Namespace

Drupal\Core\Field\Annotation
View source
class FieldType extends DataType {
    
    /**
     * The plugin ID.
     *
     * @var string
     */
    public $id;
    
    /**
     * The name of the module providing the field type plugin.
     *
     * @var string
     */
    public $module;
    
    /**
     * The human-readable name of the field type.
     *
     * @ingroup plugin_translatable
     *
     * @var \Drupal\Core\Annotation\Translation
     */
    public $label;
    
    /**
     * A short human readable description for the field type.
     *
     * @ingroup plugin_translatable
     *
     * @var \Drupal\Core\Annotation\Translation
     */
    public $description;
    
    /**
     * The category under which the field type should be listed in the UI.
     *
     * @ingroup plugin_translatable
     *
     * @var \Drupal\Core\Annotation\Translation
     */
    public $category = '';
    
    /**
     * The plugin_id of the default widget for this field type.
     *
     * This widget must be available whenever the field type is available (i.e.
     * provided by the field type module, or by a module the field type module
     * depends on).
     *
     * @var string
     */
    public $default_widget;
    
    /**
     * The plugin_id of the default formatter for this field type.
     *
     * This formatter must be available whenever the field type is available (i.e.
     * provided by the field type module, or by a module the field type module
     * depends on).
     *
     * @var string
     */
    public $default_formatter;
    
    /**
     * A boolean stating that fields of this type cannot be created through the UI.
     *
     * @var bool
     */
    public $no_ui = FALSE;
    
    /**
     * {@inheritdoc}
     */
    public $list_class;
    
    /**
     * An integer defining a fixed cardinality for this field type.
     *
     * If this value is not set, cardinality can be configured in the field UI.
     *
     * @var int|null
     */
    public $cardinality;

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DataType::$constraints public property An array of validation constraints for this type.
DataType::$definition_class public property The definition class to use for defining data of this type.
DataType::$list_definition_class public property The definition class to use for defining a list of items of this type.
DataType::$unwrap_for_canonical_representation public property Whether the typed object wraps the canonical representation of the data.
FieldType::$cardinality public property An integer defining a fixed cardinality for this field type.
FieldType::$category public property The category under which the field type should be listed in the UI.
FieldType::$default_formatter public property The plugin_id of the default formatter for this field type.
FieldType::$default_widget public property The plugin_id of the default widget for this field type.
FieldType::$description public property A short human readable description for the field type. Overrides DataType::$description
FieldType::$id public property The plugin ID. Overrides DataType::$id
FieldType::$label public property The human-readable name of the field type. Overrides DataType::$label
FieldType::$list_class public property The typed data class used for wrapping multiple data items of the type. Overrides DataType::$list_class
FieldType::$module public property The name of the module providing the field type plugin.
FieldType::$no_ui public property A boolean stating that fields of this type cannot be created through the UI.
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::get public function Gets the value of an annotation. Overrides AnnotationInterface::get 6
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass 1
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider 1
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass 1
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider
Plugin::__construct public function Constructs a Plugin object. 3

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.