You are here

public function PreviewLinkController::preview in Preview Link 8

Preview any entity with the default view mode.

Return value

array A render array for previewing the entity.

File

src/Controller/PreviewLinkController.php, line 18

Class

PreviewLinkController
Preview link controller to view any entity.

Namespace

Drupal\preview_link\Controller

Code

public function preview() {
  $entity = $this
    ->resolveEntity();
  return $this
    ->entityTypeManager()
    ->getViewBuilder($entity
    ->getEntityTypeId())
    ->view($entity);
}