class FieldType

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

Defines a FieldType attribute.

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

Hierarchy

Expanded class hierarchy of FieldType

Related topics

54 files declare their use of FieldType
AutoIncrementingTestItem.php in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/AutoIncrementingTestItem.php
BooleanItem.php in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/BooleanItem.php
ChangedItem.php in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/ChangedItem.php
ChangedTestItem.php in core/modules/system/tests/modules/entity_test/src/Plugin/Field/FieldType/ChangedTestItem.php
CommentItem.php in core/modules/comment/src/Plugin/Field/FieldType/CommentItem.php

... See full list

File

core/lib/Drupal/Core/Field/Attribute/FieldType.php, line 18

Namespace

Drupal\Core\Field\Attribute
View source
class FieldType extends Plugin {
    
    /**
     * Constructs a FieldType attribute.
     *
     * @param string $id
     *   The plugin ID.
     * @param \Drupal\Core\StringTranslation\TranslatableMarkup $label
     *   The human-readable name of the field type.
     * @param \Drupal\Core\StringTranslation\TranslatableMarkup|array|null $description
     *   (optional) A short human-readable description for the field type.
     * @param string $category
     *   (optional) The category under which the field type should be listed in
     *   the UI.
     * @param int $weight
     *   (optional) The weight of the field type.
     * @param string|null $default_widget
     *   (optional) 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).
     * @param string|null $default_formatter
     *   (optional) 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).
     * @param bool $no_ui
     *   (optional) A boolean stating that fields of this type cannot be created
     *   through the UI.
     * @param string|null $list_class
     *   (optional) The typed data class used for wrapping multiple data items of
     *   the type. Must implement the \Drupal\Core\TypedData\ListInterface.
     * @param int|null $cardinality
     *   (optional) An integer defining a fixed cardinality for this field type.
     *   If this value is not set, cardinality can be configured in the field UI.
     * @param array $constraints
     *   (optional) An array of validation constraints for this type.
     * @param array $config_dependencies
     *   (optional) An array of configuration dependencies.
     * @param array $column_groups
     *   (optional) An array of column groups for the field type.
     * @param array $serialized_property_names
     *   (optional) An array of property names that should be serialized.
     * @param string|null $deriver
     *   (optional) The deriver class for the data type.
     * @param string|null $module
     *   The name of the module providing the field type plugin.
     */
    public function __construct(string $id, TranslatableMarkup $label, TranslatableMarkup|array|null $description = NULL, string $category = '', int $weight = 0, ?string $default_widget = NULL, ?string $default_formatter = NULL, bool $no_ui = FALSE, ?string $list_class = NULL, ?int $cardinality = NULL, array $constraints = [], array $config_dependencies = [], array $column_groups = [], array $serialized_property_names = [], ?string $deriver = NULL, ?string $module = NULL) {
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AttributeBase::$class protected property The class used for this attribute class.
AttributeBase::$provider protected property The provider of the attribute class.
AttributeBase::get public function Gets the value of an attribute. Overrides AttributeInterface::get 6
AttributeBase::getClass public function Gets the class of the attribute class. Overrides AttributeInterface::getClass 1
AttributeBase::getId public function Gets the unique ID for this attribute class. Overrides AttributeInterface::getId
AttributeBase::getProvider public function Gets the name of the provider of the attribute class. Overrides AttributeInterface::getProvider
AttributeBase::setClass public function Sets the class of the attributed class. Overrides AttributeInterface::setClass 1
AttributeBase::setProvider public function Sets the name of the provider of the attribute class. Overrides AttributeInterface::setProvider
FieldType::__construct public function Constructs a FieldType attribute. Overrides Plugin::__construct

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