function bartik_preprocess_html
Same name in other branches
- 7.x themes/bartik/template.php \bartik_preprocess_html()
- 9 core/themes/bartik/bartik.theme \bartik_preprocess_html()
Implements hook_preprocess_HOOK() for HTML document templates.
Adds body classes if certain regions have content.
File
-
core/
themes/ bartik/ bartik.theme, line 16
Code
function bartik_preprocess_html(&$variables) {
// Add information about the number of sidebars.
if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
$variables['attributes']['class'][] = 'layout-two-sidebars';
}
elseif (!empty($variables['page']['sidebar_first'])) {
$variables['attributes']['class'][] = 'layout-one-sidebar';
$variables['attributes']['class'][] = 'layout-sidebar-first';
}
elseif (!empty($variables['page']['sidebar_second'])) {
$variables['attributes']['class'][] = 'layout-one-sidebar';
$variables['attributes']['class'][] = 'layout-sidebar-second';
}
else {
$variables['attributes']['class'][] = 'layout-no-sidebars';
}
if (!empty($variables['page']['featured_top'])) {
$variables['attributes']['class'][] = 'has-featured-top';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.