From 44a153acf7d6e84468090e1419380439ce136948 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole Date: Tue, 11 Feb 2014 11:18:12 +0000 Subject: [PATCH] Issue #850728 by tim.plunkett, bleen18, toco, kscheirer: Bartik: template.php cleanups. --- core/themes/bartik/bartik.theme | 52 +++++++++++++++------------------ 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme index ab4683c239f..59133a5a17e 100644 --- a/core/themes/bartik/bartik.theme +++ b/core/themes/bartik/bartik.theme @@ -63,19 +63,9 @@ function bartik_preprocess_page(&$variables) { $variables['secondary_menu']['#attributes']['class'] = array('links', 'inline', 'clearfix'); } - $site_config = \Drupal::config('system.site'); - // Always print the site name and slogan, but if they are toggled off, we'll - // just hide them visually. - $variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE; - $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE; - if ($variables['hide_site_name']) { - // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. - $variables['site_name'] = check_plain($site_config->get('name')); - } - if ($variables['hide_site_slogan']) { - // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it. - $variables['site_slogan'] = filter_xss_admin($site_config->get('slogan')); - } + // Set the options that apply to both page and maintenance page. + _bartik_process_page($variables); + // Since the title and the shortcut link are both block level elements, // positioning them next to each other is much simpler with a wrapper div. if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) { @@ -115,21 +105,8 @@ function bartik_preprocess_maintenance_page(&$variables) { ), ); - drupal_render($libraries); - - $site_config = \Drupal::config('system.site'); - // Always print the site name and slogan, but if they are toggled off, we'll - // just hide them visually. - $variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE; - $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE; - if ($variables['hide_site_name']) { - // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. - $variables['site_name'] = check_plain($site_config->get('name')); - } - if ($variables['hide_site_slogan']) { - // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it. - $variables['site_slogan'] = filter_xss_admin($site_config->get('slogan')); - } + // Set the options that apply to both page and maintenance page. + _bartik_process_page($variables); } /** @@ -197,3 +174,22 @@ function bartik_field__taxonomy_term_reference($variables) { return $output; } + +/** ++ * Helper function for handling the site name and slogan. ++ */ +function _bartik_process_page(&$variables) { + $site_config = \Drupal::config('system.site'); + // Always print the site name and slogan, but if they are toggled off, we'll + // just hide them visually. + $variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE; + $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE; + if ($variables['hide_site_name']) { + // If toggle_name is FALSE, the site_name will be empty, so we rebuild it. + $variables['site_name'] = check_plain($site_config->get('name')); + } + if ($variables['hide_site_slogan']) { + // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it. + $variables['site_slogan'] = filter_xss_admin($site_config->get('slogan')); + } +}