Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements().
Overrides FormatterInterface::viewElements
public function viewElements(EntityInterface $entity, $langcode, array $items) {
$elements = array();
foreach ($items as $delta => $item) {
// The text value has no text format assigned to it, so the user input
// should equal the output, including newlines.
$elements[$delta] = array(
'#markup' => nl2br(check_plain($item['value'])),
);
}
return $elements;
}