You are here

protected function TokenReplacer::getRenderedEntity in Advanced Entity Tokens 2.x

Fetches a rendered entity.

Parameters

string $entity_type_id: The entity type ID.

\Drupal\Core\Entity\EntityInterface $entity: The entity.

string $view_mode: The view mode.

Return value

\Drupal\Component\Render\MarkupInterface The rendered HTML

2 calls to TokenReplacer::getRenderedEntity()
TokenReplacer::getEntityViewReplacements in src/TokenReplacer.php
Fetches the entity view replacements.
TokenReplacer::getWholeEntityReplacements in src/TokenReplacer.php
Fetches an entire entity for insertion (e.g. "[aet:node:999]").

File

src/TokenReplacer.php, line 537

Class

TokenReplacer
Class TokenReplacer.

Namespace

Drupal\aet

Code

protected function getRenderedEntity(string $entity_type_id, EntityInterface $entity, string $view_mode) {
  $renderable_entity = $this->entityTypeManager
    ->getViewBuilder($entity_type_id)
    ->view($entity, $view_mode);
  return render($renderable_entity);
}