Builds a renderable array for a field value.
Drupal\Core\Entity\EntityInterface $entity: The entity being displayed.
string $langcode: The language associated with $items.
array $items: Array of values for this field.
array A renderable array for $items, as an array of child elements keyed by numeric indexes starting from 0.
Overrides FormatterInterface::viewElements
public function viewElements(EntityInterface $entity, $langcode, array $items) {
$elements = array();
if (!empty($items)) {
foreach ($items as $delta => $item) {
// This formatter only needs to output raw for testing.
$elements[$delta] = array(
'#markup' => $item['value'],
);
}
}
return $elements;
}