Field Types API
Defines field, widget, display formatter, and storage types.
In the Field API, each field has a type, which determines what kind of data (integer, string, date, etc.) the field can hold, which settings it provides, and so on. The data type(s) accepted by a field are defined in the class implementing \Drupal\Core\Field\FieldItemInterface::schema() method.
Field types are plugins with \Drupal\Core\Field\Attribute\FieldType attributes and implement plugin interface \Drupal\Core\Field\FieldItemInterface. Field Type plugins are managed by the \Drupal\Core\Field\FieldTypePluginManager class. Field type classes usually extend base class \Drupal\Core\Field\FieldItemBase. Field-type plugins need to be in the namespace \Drupal\{your_module}\Plugin\Field\FieldType. See the Plugin API topic for more information on how to define plugins.
The Field Types API also defines two kinds of pluggable handlers: widgets and formatters. Widgets specify how the field appears in edit forms, while formatters specify how the field appears in displayed entities.
See Field API for information about the other parts of the Field API.
See also¶
field