Issue #850728 by tim.plunkett, bleen18, toco, kscheirer: Bartik: template.php cleanups.
parent
d6555f2636
commit
44a153acf7
|
@ -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'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue