Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Field/FormatterInterface.php \Drupal\Core\Field\FormatterInterface::viewElements()
  2. 9 core/lib/Drupal/Core/Field/FormatterInterface.php \Drupal\Core\Field\FormatterInterface::viewElements()

Builds a renderable array for a field value.

Parameters

\Drupal\Core\Field\FieldItemListInterface $items: The field values to be rendered.

string $langcode: The language that should be used to render the field.

Return value

array A renderable array for $items, as an array of child elements keyed by consecutive numeric indexes starting from 0.

1 call to FormatterInterface::viewElements()
FormatterBase::view in core/lib/Drupal/Core/Field/FormatterBase.php
Builds a renderable array for a fully themed field.
4 methods override FormatterInterface::viewElements()
BaseFieldFileFormatterBase::viewElements in core/modules/file/src/Plugin/Field/FieldFormatter/BaseFieldFileFormatterBase.php
Builds a renderable array for a field value.
DateTimeFormatterBase::viewElements in core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php
Builds a renderable array for a field value.
FileMediaFormatterBase::viewElements in core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php
Builds a renderable array for a field value.
NumericFormatterBase::viewElements in core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericFormatterBase.php
Builds a renderable array for a field value.

File

core/lib/Drupal/Core/Field/FormatterInterface.php, line 88

Class

FormatterInterface
Interface definition for field formatter plugins.

Namespace

Drupal\Core\Field

Code

public function viewElements(FieldItemListInterface $items, $langcode);