You are here

public function BlazyEntityBase::buildElement in Blazy 8.2

Same name and namespace in other branches
  1. 8 src/Dejavu/BlazyEntityBase.php \Drupal\blazy\Dejavu\BlazyEntityBase::buildElement()

Returns item contents.

2 calls to BlazyEntityBase::buildElement()
BlazyEntityBase::buildElements in src/Dejavu/BlazyEntityBase.php
Returns media contents.
BlazyEntityMediaBase::buildElement in src/Dejavu/BlazyEntityMediaBase.php
Returns item contents.
1 method overrides BlazyEntityBase::buildElement()
BlazyEntityMediaBase::buildElement in src/Dejavu/BlazyEntityMediaBase.php
Returns item contents.

File

src/Dejavu/BlazyEntityBase.php, line 45

Class

BlazyEntityBase
Base class for entity reference formatters without field details.

Namespace

Drupal\blazy\Dejavu

Code

public function buildElement(array &$build, $entity, $langcode) {
  $view_mode = empty($build['settings']['view_mode']) ? 'full' : $build['settings']['view_mode'];
  $delta = $build['settings']['delta'];
  $build['items'][$delta] = $this
    ->formatter()
    ->getEntityTypeManager()
    ->getViewBuilder($entity
    ->getEntityTypeId())
    ->view($entity, $view_mode, $langcode);
}