You are here

protected function VideoPlayerFormatterBase::getEntitiesToView in Video 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/VideoPlayerFormatterBase.php \Drupal\video\Plugin\Field\FieldFormatter\VideoPlayerFormatterBase::getEntitiesToView()

Returns the referenced entities for display.

The method takes care of:

  • checking entity access,
  • placing the entities in the language expected for display.

It is thus strongly recommended that formatters use it in their implementation of viewElements($items) rather than dealing with $items directly.

For each entity, the EntityReferenceItem by which the entity is referenced is available in $entity->_referringItem. This is useful for field types that store additional values next to the reference itself.

Parameters

\Drupal\Core\Field\EntityReferenceFieldItemListInterface $items: The item list.

string $langcode: The language code of the referenced entities to display.

Return value

\Drupal\Core\Entity\EntityInterface[] The array of referenced entities to display, keyed by delta.

Overrides EntityReferenceFormatterBase::getEntitiesToView

See also

::prepareView()

3 calls to VideoPlayerFormatterBase::getEntitiesToView()
VideoPlayerFormatter::viewElements in src/Plugin/Field/FieldFormatter/VideoPlayerFormatter.php
Builds a renderable array for a field value.
VideoPlayerListFormatter::viewElements in src/Plugin/Field/FieldFormatter/VideoPlayerListFormatter.php
Builds a renderable array for a field value.
VideoUrlFormatter::viewElements in src/Plugin/Field/FieldFormatter/VideoUrlFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/VideoPlayerFormatterBase.php, line 17

Class

VideoPlayerFormatterBase
Base class for video player file formatters.

Namespace

Drupal\video\Plugin\Field\FieldFormatter

Code

protected function getEntitiesToView(EntityReferenceFieldItemListInterface $items, $langcode) {
  return parent::getEntitiesToView($items, $langcode);
}