Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements().
Overrides FormatterInterface::viewElements
public function viewElements(EntityInterface $entity, $langcode, array $items) {
$definition = $this
->getDefinition();
$function = $definition['module'] . '_field_formatter_view';
if (function_exists($function)) {
// hook_field_formatter_view() received an array of display properties,
$display = array(
'type' => $this
->getPluginId(),
'settings' => $this
->getSettings(),
'weight' => $this->weight,
'label' => $this->label,
);
return $function($entity
->entityType(), $entity, $this->field, $this->instance, $langcode, $items, $display);
}
}