You are here

public function ExampleFormattedField::viewElements in Extra Field 8.2

Same name and namespace in other branches
  1. 8 modules/extra_field_example/src/Plugin/ExtraField/Display/ExampleFormattedField.php \Drupal\extra_field_example\Plugin\ExtraField\Display\ExampleFormattedField::viewElements()

Returns the renderable array of the field item(s).

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The field's host entity.

Return value

array A renderable array of field elements. If this contains children, the field output will be rendered as a multiple value field with each child as a field item.

Overrides ExtraFieldDisplayFormattedInterface::viewElements

File

modules/extra_field_example/src/Plugin/ExtraField/Display/ExampleFormattedField.php, line 44

Class

ExampleFormattedField
Example Extra field with formatted output.

Namespace

Drupal\extra_field_example\Plugin\ExtraField\Display

Code

public function viewElements(ContentEntityInterface $entity) {
  return [
    [
      '#markup' => 'One',
    ],
    [
      '#markup' => 'Two',
    ],
    [
      '#markup' => 'Three',
    ],
  ];
}