You are here

public function EntityReferenceLayoutFormatter::buildEntityView in Entity Reference with Layout 8

Builds the view array for a single paragraph entity.

Parameters

\Drupal\paragraphs\ParagraphInterface $entity: The paragraph entity to render.

Return value

array Returns a render array.

2 calls to EntityReferenceLayoutFormatter::buildEntityView()
EntityReferenceLayoutFormatter::buildLayoutContainer in src/Plugin/Field/FieldFormatter/EntityReferenceLayoutFormatter.php
Builds the structure for a single layout paragraph item.
EntityReferenceLayoutFormatter::buildLayoutTree in src/Plugin/Field/FieldFormatter/EntityReferenceLayoutFormatter.php
Builds the structure for the entire layout.

File

src/Plugin/Field/FieldFormatter/EntityReferenceLayoutFormatter.php, line 162

Class

EntityReferenceLayoutFormatter
Entity Reference with Layout field formatter.

Namespace

Drupal\entity_reference_layout\Plugin\Field\FieldFormatter

Code

public function buildEntityView(ParagraphInterface $entity) {
  $view_mode = $this
    ->getSetting('view_mode');
  $view_builder = \Drupal::entityTypeManager()
    ->getViewBuilder($entity
    ->getEntityTypeId());
  return $view_builder
    ->view($entity, $view_mode, $entity
    ->language()
    ->getId());
}