public function EntityReferenceFormatterBase::viewElements

Overrides \Drupal\field\Plugin\Type\Formatter\FormatterBase::viewElements().

Overrides FormatterInterface::viewElements

See also

\Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase::viewElements().

2 calls to EntityReferenceFormatterBase::viewElements()
EntityReferenceEntityFormatter::viewElements in drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceEntityFormatter.php
Overrides \Drupal\field\Plugin\Type\Formatter\FormatterBase::viewElements().
EntityReferenceLabelFormatter::viewElements in drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceLabelFormatter.php
Overrides \Drupal\field\Plugin\Type\Formatter\FormatterBase::viewElements().
4 methods override EntityReferenceFormatterBase::viewElements()

File

drupal/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/formatter/EntityReferenceFormatterBase.php, line 102
Contains \Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase.

Class

EntityReferenceFormatterBase
Parent plugin for entity reference formatters.

Namespace

Drupal\entity_reference\Plugin\field\formatter

Code

public function viewElements(EntityInterface $entity, $langcode, array $items) {

  // Remove un-accessible items.
  foreach ($items as $delta => $item) {
    if (empty($item['access'])) {
      unset($items[$delta]);
    }
  }
  return array();
}