You are here

public function BlazyEntityBase::buildElement in Blazy 8

Same name and namespace in other branches
  1. 8.2 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.
BlazyEntityReferenceBase::buildElement in src/Dejavu/BlazyEntityReferenceBase.php
Returns item contents.
1 method overrides BlazyEntityBase::buildElement()
BlazyEntityReferenceBase::buildElement in src/Dejavu/BlazyEntityReferenceBase.php
Returns item contents.

File

src/Dejavu/BlazyEntityBase.php, line 51

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
    ->manager()
    ->getEntityTypeManager()
    ->getViewBuilder($entity
    ->getEntityTypeId())
    ->view($entity, $view_mode, $langcode);
}