You are here

public function SingleTextFieldTest::viewElements in Extra Field 8

Same name and namespace in other branches
  1. 8.2 tests/extra_field_test/src/Plugin/ExtraField/Display/SingleTextFieldTest.php \Drupal\extra_field_test\Plugin\ExtraField\Display\SingleTextFieldTest::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

tests/extra_field_test/src/Plugin/ExtraField/Display/SingleTextFieldTest.php, line 25

Class

SingleTextFieldTest
Extra field Display for a field with single item output.

Namespace

Drupal\extra_field_test\Plugin\ExtraField\Display

Code

public function viewElements(ContentEntityInterface $entity) {
  $elements = [
    '#markup' => 'Output from SingleTextFieldTest',
  ];
  return $elements;
}