diff --git a/core/includes/common.inc b/core/includes/common.inc index d551cbb..dd04e5d 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3690,7 +3690,7 @@ function drupal_prepare_page($page, $legacy = FALSE) { // in the page with defaults. if (is_string($page) || (is_array($page) && (!isset($page['#type']) || ($page['#type'] != 'page')))) { drupal_set_page_content($page); - $page = $legacy ? element_info('page') : element_info('page_body'); + $page = $legacy ? element_info('page') : element_info('page'); } // Modules can add elements to $page as needed in hook_page_build(). diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 37644a7..e582ea0 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2510,7 +2510,7 @@ function _template_preprocess_default_variables() { * * @see system_elements() */ -function template_preprocess_html_page(&$variables) { +function template_preprocess_html(&$variables) { /** @var $page \Drupal\Core\Page\HtmlPage */ $page = $variables['page_object']; @@ -2644,157 +2644,6 @@ function template_preprocess_html_page(&$variables) { } /** - * Prepares variables for HTML document templates. - * - * This is specifically for the legacy router only. - * - * Default template: html.html.twig. - * - * @param array $variables - * An associative array containing: - * - page: A render element representing the page. - * - * @see system_elements() - */ -function template_preprocess_html(&$variables) { - $language_interface = language(Language::TYPE_INTERFACE); - - // Compile a list of classes that are going to be applied to the body element. - // This allows advanced theming based on context (home page, node of certain type, etc.). - $variables['attributes']['class'][] = 'html'; - // Add a class that tells us whether we're on the front page or not. - $variables['attributes']['class'][] = $variables['is_front'] ? 'front' : 'not-front'; - // Add a class that tells us whether the page is viewed by an authenticated user or not. - $variables['attributes']['class'][] = $variables['logged_in'] ? 'logged-in' : 'not-logged-in'; - - // Add information about the number of sidebars. - if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) { - $variables['attributes']['class'][] = 'two-sidebars'; - } - elseif (!empty($variables['page']['sidebar_first'])) { - $variables['attributes']['class'][] = 'one-sidebar'; - $variables['attributes']['class'][] = 'sidebar-first'; - } - elseif (!empty($variables['page']['sidebar_second'])) { - $variables['attributes']['class'][] = 'one-sidebar'; - $variables['attributes']['class'][] = 'sidebar-second'; - } - else { - $variables['attributes']['class'][] = 'no-sidebars'; - } - - // Populate the body classes. - if ($suggestions = theme_get_suggestions(arg(), 'page', '-')) { - foreach ($suggestions as $suggestion) { - if ($suggestion != 'page-front') { - // Add current suggestion to page classes to make it possible to theme - // the page depending on the current page type (e.g. node, admin, user, - // etc.) as well as more specific data like node-12 or node-edit. - $variables['attributes']['class'][] = drupal_html_class($suggestion); - } - } - } - - // If on an individual node page, add the node type to body classes. - if ($node = menu_get_object()) { - $variables['attributes']['class'][] = drupal_html_class('node-type-' . $node->getType()); - } - - // Initializes attributes which are specific to the html and body elements. - $variables['html_attributes'] = new Attribute; - - // HTML element attributes. - $variables['html_attributes']['lang'] = $language_interface->id; - $variables['html_attributes']['dir'] = $language_interface->direction ? 'rtl' : 'ltr'; - - // Add favicon. - if (theme_get_setting('features.favicon')) { - $favicon = theme_get_setting('favicon.url'); - $type = theme_get_setting('favicon.mimetype'); - drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type)); - } - - $site_config = Drupal::config('system.site'); - // Construct page title. - if (isset($variables['page']['#title'])) { - $head_title = array( - 'title' => strip_tags($variables['page']['#title']), - 'name' => String::checkPlain($site_config->get('name')), - ); - } - elseif (drupal_get_title()) { - $head_title = array( - 'title' => strip_tags(drupal_get_title()), - 'name' => check_plain($site_config->get('name')), - ); - } - else { - $head_title = array('name' => check_plain($site_config->get('name'))); - if ($site_config->get('slogan')) { - $head_title['slogan'] = strip_tags(filter_xss_admin($site_config->get('slogan'))); - } - } - - $variables['head_title_array'] = $head_title; - $variables['head_title'] = implode(' | ', $head_title); - - // Display the html.tpl.php's default mobile metatags for responsive design. - $elements = array( - 'MobileOptimized' => array( - '#tag' => 'meta', - '#attributes' => array( - 'name' => 'MobileOptimized', - 'content' => 'width', - ), - ), - 'HandheldFriendly' => array( - '#tag' => 'meta', - '#attributes' => array( - 'name' => 'HandheldFriendly', - 'content' => 'true', - ), - ), - 'viewport' => array( - '#tag' => 'meta', - '#attributes' => array( - 'name' => 'viewport', - 'content' => 'width=device-width', - ), - ), - ); - foreach ($elements as $name => $element) { - drupal_add_html_head($element, $name); - } - - // Populate the page template suggestions. - if ($suggestions = theme_get_suggestions(arg(), 'html')) { - $variables['theme_hook_suggestions'] = $suggestions; - } - - drupal_add_library('system', 'html5shiv', TRUE); - - // Render page_top and page_bottom into top level variables. - $variables['page_top'] = array(); - if (isset($variables['page']['page_top'])) { - $variables['page_top'] = drupal_render($variables['page']['page_top']); - } - $variables['page_bottom'] = array(); - if (isset($variables['page']['page_bottom'])) { - $variables['page_bottom'][]['#markup'] = drupal_render($variables['page']['page_bottom']); - } - - // Add footer scripts as '#markup' so they can be rendered with other - // elements in page_bottom. - $footer_scripts = new RenderWrapper('drupal_get_js', array('footer')); - $variables['page_bottom'][] = array('#markup' => $footer_scripts); - - // Wrap function calls in an object so they can be called when printed. - $variables['head'] = new RenderWrapper('drupal_get_html_head'); - $variables['styles'] = new RenderWrapper('drupal_get_css'); - $variables['scripts'] = new RenderWrapper('drupal_get_js'); -} - -/** * Prepares variables for the page template. * * Default template: page.html.twig. @@ -3165,10 +3014,6 @@ function drupal_common_theme() { return array( // From theme.inc. 'html' => array( - 'render element' => 'page', - 'template' => 'html', - ), - 'html_page' => array( 'variables' => array('page_object' => NULL), 'template' => 'html', ), diff --git a/core/lib/Drupal/Core/Controller/ExceptionController.php b/core/lib/Drupal/Core/Controller/ExceptionController.php index d010819..0f8f2c4 100644 --- a/core/lib/Drupal/Core/Controller/ExceptionController.php +++ b/core/lib/Drupal/Core/Controller/ExceptionController.php @@ -147,7 +147,7 @@ public function on403Html(FlattenException $exception, Request $request) { $page->setTitle(t('Access denied')); $page->setStatusCode(403); - $output = theme('html_page', array('page_object' => $page)); + $output = theme('html', array('page_object' => $page)); $response = new Response($output, $page->getStatusCode()); return $response; @@ -223,7 +223,7 @@ public function on404Html(FlattenException $exception, Request $request) { $page->setTitle(t('Page not found')); $page->setStatusCode(404); - $output = theme('html_page', array('page_object' => $page)); + $output = theme('html', array('page_object' => $page)); $response = new Response($output, $page->getStatusCode()); } diff --git a/core/lib/Drupal/Core/Controller/HtmlFormController.php b/core/lib/Drupal/Core/Controller/HtmlFormController.php index 5f5ca4f..246611a 100644 --- a/core/lib/Drupal/Core/Controller/HtmlFormController.php +++ b/core/lib/Drupal/Core/Controller/HtmlFormController.php @@ -51,7 +51,7 @@ public function __construct(ControllerResolverInterface $resolver, ContainerInte protected function getFormObject(Request $request, $form_arg) { // If this is a class, instantiate it. if (class_exists($form_arg)) { - if (in_array('Drupal\Core\Controller\ControllerInterface', class_implements($form_arg))) { + if (in_array('Drupal\Core\DependencyInjection\ContainerInjectionInterface', class_implements($form_arg))) { return $form_arg::create($this->container); } diff --git a/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php index 6d59657..35a57d3 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ViewSubscriber.php @@ -41,7 +41,7 @@ public function __construct(ContentNegotiation $negotiation) { public function onHtmlPage(GetResponseForControllerResultEvent $event) { $page = $event->getControllerResult(); if ($page instanceof HtmlPage) { - $output = theme('html_page', array('page_object' => $page)); + $output = theme('html', array('page_object' => $page)); $response = new Response((string)$output, $page->getStatusCode()); @@ -139,26 +139,6 @@ public function onIframeUpload(GetResponseForControllerResultEvent $event) { } /** - * Processes a successful controller into an HTTP 200 response. - * - * Some controllers may not return a response object but simply the body of - * one. The VIEW event is called in that case, to allow us to mutate that - * body into a Response object. In particular we assume that the return from - * an HTML-type response is a render array from a legacy page callback and - * render it. - * - * @param Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent $event - * The Event to process. - */ - public function onHtml(GetResponseForControllerResultEvent $event) { - $attributes = $event->getRequest()->attributes; - $error = sprintf("Route is returning a render array when it shouldn't: _controller: %s, _content: %s, route: %s", $attributes->get('_controller'), $attributes->get('_content'), $attributes->get('_route')); - trigger_error($error, E_USER_DEPRECATED); - $page_callback_result = $event->getControllerResult(); - return new Response(drupal_render_page($page_callback_result)); - } - - /** * Registers the methods in this class that should be listeners. * * @return array diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index 93b039d..e657681 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -312,8 +312,6 @@ function system_batch_page() { elseif (isset($output)) { // Force a page without blocks or messages to // display a list of collected messages later. - return new HtmlPage($output); - // @todo Figure out how to remove blocks but still render the page. drupal_set_page_content($output); $page = element_info('page'); $page['#show_messages'] = FALSE; diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 4593efd..9f73be9 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -261,11 +261,6 @@ function system_element_info() { $types['page'] = array( '#show_messages' => TRUE, '#theme' => 'page', - '#theme_wrappers' => array('html'), - ); - $types['page_body'] = array( - '#show_messages' => TRUE, - '#theme' => 'page', ); // By default, we don't want Ajax commands being rendered in the context of an // HTML page, so we don't provide defaults for #theme or #theme_wrappers.