You are here

public function BibciteEntityPreviewController::view in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/Controller/BibciteEntityPreviewController.php \Drupal\bibcite_entity\Controller\BibciteEntityPreviewController::view()

Provides a page to render a single entity.

Parameters

\Drupal\Core\Entity\EntityInterface $_entity: The Entity to be rendered. Note this variable is named $_entity rather than $entity to prevent collisions with other named placeholders in the route.

string $view_mode: (optional) The view mode that should be used to display the entity. Defaults to 'full'.

Return value

array A render array as expected by \Drupal\Core\Render\RendererInterface::render().

Overrides EntityViewController::view

1 string reference to 'BibciteEntityPreviewController::view'
bibcite_entity.routing.yml in modules/bibcite_entity/bibcite_entity.routing.yml
modules/bibcite_entity/bibcite_entity.routing.yml

File

modules/bibcite_entity/src/Controller/BibciteEntityPreviewController.php, line 48

Class

BibciteEntityPreviewController
Defines a controller to render a single bibcite entity in preview.

Namespace

Drupal\bibcite_entity\Controller

Code

public function view(EntityInterface $bibcite_reference_preview, $view_mode_id = 'default', $langcode = NULL) {
  $bibcite_reference_preview->preview_view_mode = $view_mode_id;
  $build = parent::view($bibcite_reference_preview, $view_mode_id);
  $build['#attached']['library'][] = 'bibcite_entity/reference.preview';

  // Don't render cache previews.
  unset($build['#cache']);
  return $build;
}