3 namespace Drupal\Core\Field\Annotation;
5 use Drupal\Component\Annotation\Plugin;
8 * Defines a FieldFormatter annotation object.
10 * Formatters handle the display of field values. They are typically
11 * instantiated and invoked by an EntityDisplay object.
13 * Additional annotation keys for formatters can be defined in
14 * hook_field_formatter_info_alter().
18 * @see \Drupal\Core\Field\FormatterPluginManager
19 * @see \Drupal\Core\Field\FormatterInterface
21 * @ingroup field_formatter
23 class FieldFormatter extends Plugin {
33 * The human-readable name of the formatter type.
35 * @ingroup plugin_translatable
37 * @var \Drupal\Core\Annotation\Translation
42 * A short description of the formatter type.
44 * @ingroup plugin_translatable
46 * @var \Drupal\Core\Annotation\Translation
51 * The name of the field formatter class.
53 * This is not provided manually, it will be added by the discovery mechanism.
60 * An array of field types the formatter supports.
64 public $field_types = [];
67 * An integer to determine the weight of this formatter relative to other
68 * formatter in the Field UI when selecting a formatter for a given field
73 public $weight = NULL;