diff --git a/core/includes/theme.inc b/core/includes/theme.inc index f136ca1..7b64c7c 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1677,27 +1677,29 @@ 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'; - $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); - } - } + // 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. + $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; $site_config = \Drupal::config('system.site'); // Construct page title. @@ -1787,15 +1789,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'] = \Drupal::url(''); $variables['language'] = $language_interface; @@ -1875,16 +1868,16 @@ function template_preprocess_page(&$variables) { */ function theme_get_suggestions($args, $base, $delimiter = '__') { - // Build a list of suggested theme hooks or body classes in order of + // Build a list of suggested theme hooks in order of // specificity. One suggestion is made for every element of the current path, // though numeric elements are not carried to subsequent suggestions. For // example, for $base='page', http://www.example.com/node/1/edit would result - // in the following suggestions and body classes: + // in the following suggestions: // - // page__node page-node - // page__node__% page-node-% - // page__node__1 page-node-1 - // page__node__edit page-node-edit + // page__node + // page__node__% + // page__node__1 + // page__node__edit $suggestions = array(); $prefix = $base; @@ -1939,7 +1932,6 @@ function template_preprocess_maintenance_page(&$variables) { $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/modules/block/block.module b/core/modules/block/block.module index 2b6d8bd..a0b63a1 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -83,7 +83,7 @@ function block_page_build(&$page) { // Append region description if we are rendering the regions demo page. $visible_regions = array_keys(system_region_list($theme, REGIONS_VISIBLE)); foreach ($visible_regions as $region) { - $description = '
' . $all_regions[$region] . '
'; + $description = '
' . $all_regions[$region] . '
'; $page[$region]['block_description'] = array( '#markup' => $description, '#weight' => 15, diff --git a/core/themes/bartik/css/style.css b/core/themes/bartik/css/style.css index 9deef51..a5fa4f5 100644 --- a/core/themes/bartik/css/style.css +++ b/core/themes/bartik/css/style.css @@ -1786,14 +1786,18 @@ div.add-or-remove-shortcuts { } /* ---------- Admin-specific Theming ---------- */ - .page-admin #content img { margin-right: 15px; /* LTR */ } .page-admin #content .simpletest-image img { margin: 0; } -.page-admin-structure-block-demo .block-region { +.page-admin #admin-dblog img { + margin: 0 5px; +} + +/* Block demo mode */ +.demo-block { background: #ffff66; border: 1px dotted #9f9e00; color: #000; @@ -1803,15 +1807,12 @@ div.add-or-remove-shortcuts { text-align: center; text-shadow: none; } -.page-admin-structure-block-demo #featured .block-region { +#featured .demo-block { font-size: 0.55em; } -.page-admin-structure-block-demo #header .block-region { +#header .demo-block { width: 500px; } -.page-admin #admin-dblog img { - margin: 0 5px; -} /* Configuration. */ div.admin .right, diff --git a/core/themes/seven/css/layout/node-add.css b/core/themes/seven/css/layout/node-add.css index 6bbe892..7f5274a 100644 --- a/core/themes/seven/css/layout/node-add.css +++ b/core/themes/seven/css/layout/node-add.css @@ -10,9 +10,7 @@ @media screen and (min-width: 780px), (orientation: landscape) and (min-device-height: 780px) { - - [class*="page-node-add-"] .messages, - .page-node-edit .messages { + .node-form-layout .messages { margin-top: 1em; margin-bottom: 1em; } @@ -20,7 +18,6 @@ @media screen and (max-width: 1020px), (orientation: landscape) and (max-device-height: 1020px) { - .toolbar-vertical .block-list-secondary, .toolbar-vertical .layout-region-node-secondary { margin-bottom: 0; diff --git a/core/themes/seven/css/theme/install-page.css b/core/themes/seven/css/theme/install-page.css index d114dac..c9d124d 100644 --- a/core/themes/seven/css/theme/install-page.css +++ b/core/themes/seven/css/theme/install-page.css @@ -3,7 +3,7 @@ * Installation styling. * * Unfortunately we have to make our styling quite strong, to override the - * .in-maintenance styling. + * .maintenance-page styling. */ .install-background { background-color: #1275b2; diff --git a/core/themes/seven/css/theme/maintenance-page.css b/core/themes/seven/css/theme/maintenance-page.css index 80b18f9..edf9018 100644 --- a/core/themes/seven/css/theme/maintenance-page.css +++ b/core/themes/seven/css/theme/maintenance-page.css @@ -13,7 +13,7 @@ /* Maintenance theming */ .install-page, -.in-maintenance { +.maintenance-page { background: none; } .page-title { @@ -131,13 +131,13 @@ html { display: table; } - .in-maintenance, - .install-page { + .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%; diff --git a/core/themes/seven/seven.theme b/core/themes/seven/seven.theme index ccd1c92..7f05e4d 100644 --- a/core/themes/seven/seven.theme +++ b/core/themes/seven/seven.theme @@ -232,3 +232,16 @@ function seven_form_node_form_alter(&$form, FormStateInterface $form_state) { $form['revision_information']['#type'] = 'container'; $form['revision_information']['#group'] = 'meta'; } + + function seven_preprocess_html(&$variables) { + + // If on a node add or edit page, add a node-layout class. + $path_args = explode('/', current_path()); + if ($suggestions = theme_get_suggestions($path_args, 'page', '-')) { + foreach ($suggestions as $suggestion) { + if ( $suggestion === 'page-node-edit' || strpos($suggestion,'page-node-add') !== false) { + $variables['attributes']['class'][] = drupal_html_class('node-form-layout'); + } + } + } +}