Chris@0: preview_view_mode = $view_mode_id; Chris@0: $build = parent::view($node_preview, $view_mode_id); Chris@0: Chris@0: $build['#attached']['library'][] = 'node/drupal.node.preview'; Chris@0: Chris@0: // Don't render cache previews. Chris@0: unset($build['#cache']); Chris@0: Chris@0: return $build; Chris@0: } Chris@0: Chris@0: /** Chris@0: * The _title_callback for the page that renders a single node in preview. Chris@0: * Chris@0: * @param \Drupal\Core\Entity\EntityInterface $node_preview Chris@0: * The current node. Chris@0: * Chris@0: * @return string Chris@0: * The page title. Chris@0: */ Chris@0: public function title(EntityInterface $node_preview) { Chris@0: return $this->entityManager->getTranslationFromContext($node_preview)->label(); Chris@0: } Chris@0: Chris@0: }