Field Formatter API
Same name in other branches
- 7.x modules/field/field.api.php \field_formatter
- 8.9.x core/modules/field/field.api.php \field_formatter
- 10 core/modules/field/field.api.php \field_formatter
- 11.x core/modules/field/field.api.php \field_formatter
Define Field API formatter types.
Field API formatters specify how fields are displayed when the entity to which the field is attached is displayed. Fields of a given field type may be displayed using more than one formatter. In this case, the Field UI module allows the site builder to choose which formatter to use.
Formatters are Plugins managed by the \Drupal\Core\Field\FormatterPluginManager class. A formatter is a plugin annotated with class \Drupal\Core\Field\Annotation\FieldFormatter that implements \Drupal\Core\Field\FormatterInterface (in most cases, by subclassing \Drupal\Core\Field\FormatterBase). Formatter plugins need to be in the namespace \Drupal\{your_module}\Plugin\Field\FieldFormatter.
See also
Parent topics
File
-
core/
modules/ field/ field.api.php, line 457
Functions
Title Sort descending | File name | Summary |
---|---|---|
hook_field_formatter_info_alter | core/ |
Perform alterations on Field API formatter types. |
Classes
Title Sort descending | File name | Summary |
---|---|---|
FieldFormatter | core/ |
Defines a FieldFormatter annotation object. |
FormatterBase | core/ |
Base class for 'Field formatter' plugin implementations. |
FormatterPluginManager | core/ |
Plugin type manager for field formatters. |
Interfaces
Title Sort descending | File name | Summary |
---|---|---|
FormatterInterface | core/ |
Interface definition for field formatter plugins. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.