diff --git a/core/includes/theme.inc b/core/includes/theme.inc index ddd9d70..3245adc 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1960,27 +1960,32 @@ function template_preprocess_html(&$variables) { $variables['page'] = $page; // 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.). + // This allows advanced theming based on context (home page, node of certain + // type, etc.). $body_classes = $variables['attributes']['class']; - $body_classes[] = 'html'; - // Add a class that tells us whether we're on the front page or not. - $body_classes[] = $variables['is_front'] ? 'front' : 'not-front'; - // Add a class that tells us whether the page is viewed by an authenticated user or not. - $body_classes[] = $variables['logged_in'] ? 'logged-in' : 'not-logged-in'; + + // Add a class that tells us whether the page is viewed by an authenticated + // user. + if ($variables['logged_in']) { + $body_classes[] = 'user-logged-in'; + } + // Add a class that tells us what path the page is located make it possible + // to theme the page depending on the current path (e.g. node, admin, user, + // etc.) as well as more specific data like path-frontpage or + // path-$contenttype. + $path = \Drupal::request()->getPathInfo(); + + if (drupal_is_front_page()) { + $body_classes[] = 'path-frontpage'; + } + else { + $segment = explode("/", $path); + $body_classes[] = 'path-' . drupal_html_class($segment[1]); + } + $variables['attributes']['class'] = $body_classes; $path_args = explode('/', current_path()); - // Populate the body classes. - if ($suggestions = theme_get_suggestions($path_args, '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); - } - } - } $site_config = \Drupal::config('system.site'); // Construct page title. @@ -2056,15 +2061,6 @@ function template_preprocess_page(&$variables) { } } - // Set up layout variable. - $variables['layout'] = 'none'; - if (!empty($variables['page']['sidebar_first'])) { - $variables['layout'] = 'first'; - } - if (!empty($variables['page']['sidebar_second'])) { - $variables['layout'] = ($variables['layout'] == 'first') ? 'both' : 'second'; - } - $variables['base_path'] = base_path(); $variables['front_page'] = url(); $variables['language'] = $language_interface; @@ -2237,7 +2233,6 @@ function template_preprocess_maintenance_page(&$variables) { $page_object = $variables['page']['#page']; $attributes = $page_object->getBodyAttributes(); $classes = $attributes['class']; - $classes[] = 'maintenance-page'; $classes[] = 'in-maintenance'; if (isset($variables['db_is_active']) && !$variables['db_is_active']) { $classes[] = 'db-offline'; diff --git a/core/themes/seven/maintenance-page.css b/core/themes/seven/maintenance-page.css index fb1e3a0..89e9ac3 100644 --- a/core/themes/seven/maintenance-page.css +++ b/core/themes/seven/maintenance-page.css @@ -15,7 +15,7 @@ /* Maintenance theming */ .install-page, -.in-maintenance { +.maintenance-page { background: none; } .name-and-slogan h1 { @@ -128,12 +128,12 @@ display: table; } .in-maintenance, - .install-page { + .maintenance-page { display: table-cell; padding: 1em 0; vertical-align: middle; } - html, .install-page, .in-maintenance { + html, .install-page, .maintenance-page { margin: 0; width: 100%; height: 100%;