public NodePreviewController::view(EntityInterface $node_preview, $view_mode_id = 'full', $langcode = NULL)
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_render().
Overrides EntityViewController::view
File
- core/modules/node/src/Controller/NodePreviewController.php, line 16
Class
- NodePreviewController
- Defines a controller to render a single node in preview.
Namespace
Drupal\node\Controller
Code
public function view(EntityInterface $node_preview, $view_mode_id = 'full', $langcode = NULL) { $node_preview->preview_view_mode = $view_mode_id; $build = parent::view($node_preview, $view_mode_id); $build['#attached']['library'][] = 'node/drupal.node.preview'; // Don't render cache previews. unset($build['#cache']); return $build; }
Please login to continue.