class FieldFormatter in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Field/Annotation/FieldFormatter.php \Drupal\Core\Field\Annotation\FieldFormatter
- 9 core/lib/Drupal/Core/Field/Annotation/FieldFormatter.php \Drupal\Core\Field\Annotation\FieldFormatter
Defines a FieldFormatter annotation object.
Formatters handle the display of field values. They are typically instantiated and invoked by an EntityDisplay object.
Additional annotation keys for formatters can be defined in hook_field_formatter_info_alter().
Hierarchy
- class \Drupal\Component\Annotation\Plugin implements AnnotationInterface
- class \Drupal\Core\Field\Annotation\FieldFormatter
Expanded class hierarchy of FieldFormatter
See also
\Drupal\Core\Field\FormatterPluginManager
\Drupal\Core\Field\FormatterInterface
Related topics
65 classes are annotated with FieldFormatter
- AttachmentTestFormatter in core/
modules/ views/ tests/ modules/ views_test_formatter/ src/ Plugin/ Field/ FieldFormatter/ AttachmentTestFormatter.php - Plugin implementation of the 'number_unformatted_with_attachment' formatter.
- AuthorFormatter in core/
modules/ user/ src/ Plugin/ Field/ FieldFormatter/ AuthorFormatter.php - Plugin implementation of the 'author' formatter.
- AuthorNameFormatter in core/
modules/ comment/ src/ Plugin/ Field/ FieldFormatter/ AuthorNameFormatter.php - Plugin implementation of the 'comment_username' formatter.
- BasicStringFormatter in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ BasicStringFormatter.php - Plugin implementation of the 'basic_string' formatter.
- BooleanFormatter in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ BooleanFormatter.php - Plugin implementation of the 'boolean' formatter.
File
- core/
lib/ Drupal/ Core/ Field/ Annotation/ FieldFormatter.php, line 23
Namespace
Drupal\Core\Field\AnnotationView source
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 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 = [];
/**
* An integer to determine the weight of this formatter relative to other
* formatter in the Field UI when selecting a formatter for a given field
* instance.
*
* This property is optional and it does not need to be declared.
*
* @var int
*/
public $weight = NULL;
}
Members
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 | An integer to determine the weight of this formatter relative to other formatter in the Field UI when selecting a formatter for a given field instance. | |
Plugin:: |
protected | property | The plugin definition read from the class annotation. | 1 |
Plugin:: |
public | function |
Gets the value of an annotation. Overrides AnnotationInterface:: |
6 |
Plugin:: |
public | function |
Gets the class of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
public | function |
Gets the unique ID for this annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function |
Gets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
protected | function | Parses an annotation into its definition. | |
Plugin:: |
public | function |
Sets the class of the annotated class. Overrides AnnotationInterface:: |
1 |
Plugin:: |
public | function |
Sets the name of the provider of the annotated class. Overrides AnnotationInterface:: |
|
Plugin:: |
public | function | Constructs a Plugin object. | 3 |