diff -u b/core/includes/theme.inc b/core/includes/theme.inc --- b/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1971,6 +1971,29 @@ // 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.). $body_classes = $variables['attributes']['class']; + // Add a class that tells us whether the page is viewed by an authenticated user. + $body_classes[] = $variables['logged_in'] ? '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. + + // Add a class that tells us where in the path we are + $path = arg(); + if( empty($path['0']) ){ + $body_classes[] = 'path-frontpage' ; + }else{ + $body_classes[] = 'path-' . $path['0'] ; + } + + $variables['attributes']['class'] = $body_classes; + + $site_config = \Drupal::config('system.site'); + // Construct page title. + if ($page->hasTitle()) { + + // 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.). + $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'; @@ -1996,26 +2018,0 @@ - - // 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.). - $body_classes = $variables['attributes']['class']; - // 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 = arg(); - if( empty($path['0']) ) { - $body_classes[] = 'path-frontpage' ; - }else{ - $body_classes[] = 'path-' . $path['0'] ; - } - - $variables['attributes']['class'] = $body_classes; - - $site_config = \Drupal::config('system.site'); - // Construct page title. - if ($page->hasTitle()) { @@ -2086,14 +2083,6 @@ } } - // 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(); @@ -2112,6 +2101,14 @@ } } + // 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(); @@ -2246,7 +2243,6 @@ $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'; } @@ -2272,6 +2268,7 @@ $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'; } only in patch2: unchanged: --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -583,9 +583,9 @@ function node_is_page(NodeInterface $node) { * Implements hook_preprocess_HOOK() for HTML document templates. */ function node_preprocess_html(&$variables) { - // If on an individual node page, add the node type to body classes. + // If on an individual node page, add the node type to body classes if (($node = \Drupal::request()->attributes->get('node')) && $node instanceof NodeInterface) { - $variables['attributes']['class'][] = drupal_html_class('node-type-' . $node->getType()); + $variables['attributes']['class'][] = drupal_html_class('content-type-' . $node->getType()); } }