class FieldFormatter
Same name in this branch
- 10 core/lib/Drupal/Core/Field/Annotation/FieldFormatter.php \Drupal\Core\Field\Annotation\FieldFormatter
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Annotation/FieldFormatter.php \Drupal\Core\Field\Annotation\FieldFormatter
- 8.9.x core/lib/Drupal/Core/Field/Annotation/FieldFormatter.php \Drupal\Core\Field\Annotation\FieldFormatter
- 11.x core/lib/Drupal/Core/Field/Attribute/FieldFormatter.php \Drupal\Core\Field\Attribute\FieldFormatter
- 11.x core/lib/Drupal/Core/Field/Annotation/FieldFormatter.php \Drupal\Core\Field\Annotation\FieldFormatter
Defines a FieldFormatter attribute for plugin discovery.
Formatters handle the display of field values. They are typically instantiated and invoked by an EntityDisplay object.
Additional attribute keys for formatters can be defined in hook_field_formatter_info_alter().
Hierarchy
- class \Drupal\Component\Plugin\Attribute\AttributeBase implements \Drupal\Component\Plugin\Attribute\AttributeInterface
- class \Drupal\Component\Plugin\Attribute\Plugin extends \Drupal\Component\Plugin\Attribute\AttributeBase
- class \Drupal\Core\Field\Attribute\FieldFormatter extends \Drupal\Component\Plugin\Attribute\Plugin
- class \Drupal\Component\Plugin\Attribute\Plugin extends \Drupal\Component\Plugin\Attribute\AttributeBase
Expanded class hierarchy of FieldFormatter
See also
\Drupal\Core\Field\FormatterPluginManager
\Drupal\Core\Field\FormatterInterface
Related topics
66 files declare their use of FieldFormatter
- AttachmentTestFormatter.php in core/
modules/ views/ tests/ modules/ views_test_formatter/ src/ Plugin/ Field/ FieldFormatter/ AttachmentTestFormatter.php - AuthorFormatter.php in core/
modules/ user/ src/ Plugin/ Field/ FieldFormatter/ AuthorFormatter.php - AuthorNameFormatter.php in core/
modules/ comment/ src/ Plugin/ Field/ FieldFormatter/ AuthorNameFormatter.php - BasicStringFormatter.php in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ BasicStringFormatter.php - BooleanFormatter.php in core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldFormatter/ BooleanFormatter.php
File
-
core/
lib/ Drupal/ Core/ Field/ Attribute/ FieldFormatter.php, line 24
Namespace
Drupal\Core\Field\AttributeView source
class FieldFormatter extends Plugin {
/**
* Constructs a FieldFormatter attribute.
*
* @param string $id
* The plugin ID.
* @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $label
* (optional) The human-readable name of the formatter type.
* @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $description
* (optional) A short description of the formatter type.
* @param string[] $field_types
* (optional) An array of field types the formatter supports.
* @param int|null $weight
* (optional) An integer to determine the weight of this formatter.
* Weight is relative to other formatters in the Field UI when selecting a
* formatter for a given field instance.
* @param class-string|null $deriver
* (optional) The deriver class.
*/
public function __construct(string $id, ?TranslatableMarkup $label = NULL, ?TranslatableMarkup $description = NULL, array $field_types = [], ?int $weight = NULL, ?string $deriver = NULL) {
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
AttributeBase::$class | protected | property | The class used for this attribute class. | ||
AttributeBase::$provider | protected | property | The provider of the attribute class. | ||
AttributeBase::get | public | function | Gets the value of an attribute. | Overrides AttributeInterface::get | 6 |
AttributeBase::getClass | public | function | Gets the class of the attribute class. | Overrides AttributeInterface::getClass | 1 |
AttributeBase::getId | public | function | Gets the unique ID for this attribute class. | Overrides AttributeInterface::getId | |
AttributeBase::getProvider | public | function | Gets the name of the provider of the attribute class. | Overrides AttributeInterface::getProvider | |
AttributeBase::setClass | public | function | Sets the class of the attributed class. | Overrides AttributeInterface::setClass | 1 |
AttributeBase::setProvider | public | function | Sets the name of the provider of the attribute class. | Overrides AttributeInterface::setProvider | |
FieldFormatter::__construct | public | function | Constructs a FieldFormatter attribute. | Overrides Plugin::__construct |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.