Defines a FieldFormatter annotation object.
Formatters handle the display of field values. Formatter hooks are typically called by the Field Attach API field_attach_prepare_view() and field_attach_view() functions.
Additional annotation keys for formatters can be defined in hook_field_formatter_info_alter().
Expanded class hierarchy of FieldFormatter
\Drupal\field\Plugin\Type\Formatter\FormatterPluginManager
\Drupal\field\Plugin\Type\Formatter\FormatterInterface
class FieldFormatter extends Plugin {
/**
* The plugin ID.
*
* @var string
*/
public $id;
/**
* The human-readable name of the formatter type.
*
* @ingroup plugin_translatable
*
* @var \Drupal\Core\Annotation\Translation
*/
public $label;
/**
* A short description of the formatter type.
*
* @ingroup plugin_translatable
*
* @var \Drupal\Core\Annotation\Translation
*/
public $description;
/**
* The name of the module providing the formatter.
*
* @var string
*/
public $module;
/**
* The name of the field formatter class.
*
* This is not provided manually, it will be added by the discovery mechanism.
*
* @var string
*/
public $class;
/**
* An array of field types the formatter supports.
*
* @var array
*/
public $field_types = array();
/**
* An array whose keys are the names of the settings available to the
* formatter type, and whose values are the default values for those settings.
*
* @var array
*/
public $settings = array();
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FieldFormatter:: |
public | property | The name of the field formatter class. | |
FieldFormatter:: |
public | property | A short description of the formatter type. | |
FieldFormatter:: |
public | property | An array of field types the formatter supports. | |
FieldFormatter:: |
public | property | The plugin ID. | |
FieldFormatter:: |
public | property | The human-readable name of the formatter type. | |
FieldFormatter:: |
public | property | The name of the module providing the formatter. | |
FieldFormatter:: |
public | property | An array whose keys are the names of the settings available to the formatter type, and whose values are the default values for those settings. | |
Plugin:: |
protected | property | The plugin definiton read from the class annotation. | |
Plugin:: |
public | function |
Implements Drupal\Core\Annotation\AnnotationInterface::get(). Overrides AnnotationInterface:: |
|
Plugin:: |
protected | function | Parses an annotation into its definition. | |
Plugin:: |
public | function | Constructs a Plugin object. |