diff --git a/core/modules/node/node.module b/core/modules/node/node.module index e842134..43acb73 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1047,8 +1047,8 @@ function node_view_multiple($nodes, $view_mode = 'teaser', $langcode = NULL) { */ function node_page_build(&$page) { // Add 'Back to content edit editing' link on preview page. - $attributes = \Drupal::request()->attributes; - if ($attributes->get(RouteObjectInterface::ROUTE_NAME) == 'node.preview') { + $route_match = \Drupal::routeMatch(); + if ($route_match->getRouteName() == 'node.preview') { $page['page_top']['node_preview'] = array( '#type' => 'container', '#attributes' => array( @@ -1056,7 +1056,7 @@ function node_page_build(&$page) { ), ); - $form = \Drupal::formBuilder()->getForm('\Drupal\node\Form\NodePreviewForm', $attributes->get('node_preview')); + $form = \Drupal::formBuilder()->getForm('\Drupal\node\Form\NodePreviewForm', $route_match->getParameter('node_preview')); $page['page_top']['node_preview']['view_mode'] = $form; } }