You are here

public function EntityAnalyser::renderEntity in Real-time SEO for Drupal 8.2

Takes an entity and renders it.

Parameters

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

Return value

\Drupal\Component\Render\MarkupInterface The markup that represents the rendered entity.

1 call to EntityAnalyser::renderEntity()
EntityAnalyser::createEntityPreview in src/EntityAnalyser.php
Takes an entity, renders it and adds the metatag values.

File

src/EntityAnalyser.php, line 139

Class

EntityAnalyser
Provides a preview renderer for entities.

Namespace

Drupal\yoast_seo

Code

public function renderEntity(EntityInterface $entity) {
  $type = $entity
    ->getEntityTypeId();
  $view_builder = $this->entityTypeManager
    ->getViewBuilder($type);

  // @todo Make the view mode configurable in Yoast SEO settings.
  $render_array = $view_builder
    ->view($entity, 'full');
  return $this->renderer
    ->renderRoot($render_array);
}