You are here

public function DummyImageFormatter::viewElements in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldFormatter/DummyImageFormatter.php \Drupal\image_module_test\Plugin\Field\FieldFormatter\DummyImageFormatter::viewElements()
  2. 10 core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldFormatter/DummyImageFormatter.php \Drupal\image_module_test\Plugin\Field\FieldFormatter\DummyImageFormatter::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.

Overrides FormatterInterface::viewElements

File

core/modules/image/tests/modules/image_module_test/src/Plugin/Field/FieldFormatter/DummyImageFormatter.php, line 27

Class

DummyImageFormatter
Plugin implementation of the Dummy image formatter.

Namespace

Drupal\image_module_test\Plugin\Field\FieldFormatter

Code

public function viewElements(FieldItemListInterface $items, $langcode) {
  return [
    [
      '#markup' => 'Dummy',
    ],
  ];
}