Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NodePreviewController.php

function NodePreviewController::view

Overrides EntityViewController::view

1 string reference to 'NodePreviewController::view'
node.routing.yml in core/modules/node/node.routing.yml
core/modules/node/node.routing.yml

File

core/modules/node/src/Controller/NodePreviewController.php, line 53

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal