Skip to content

Instantly share code, notes, and snippets.

@steveoliver
Created October 16, 2013 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steveoliver/7002424 to your computer and use it in GitHub Desktop.
Save steveoliver/7002424 to your computer and use it in GitHub Desktop.
theme.inc::template_preprocess_html checking visibilitiy of regions using has_render_content().
// Add information about the number of sidebars.
if (has_render_content($variables['page'], 'sidebar_first') && has_render_content($variables['page'], 'sidebar_second')) {
$variables['attributes']['class'][] = 'two-sidebars';
}
elseif (has_render_content($variables['page'], 'sidebar_first')) {
$variables['attributes']['class'][] = 'one-sidebar';
$variables['attributes']['class'][] = 'sidebar-first';
}
elseif (has_render_content($variables['page'], 'sidebar_second')) {
$variables['attributes']['class'][] = 'one-sidebar';
$variables['attributes']['class'][] = 'sidebar-second';
}
else {
$variables['attributes']['class'][] = 'no-sidebars';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment