You are here

function umami_preprocess_html in Drupal 9

Same name and namespace in other branches
  1. 8 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_html()

Implements hook_preprocess_HOOK() for HTML document templates.

Adds body classes if certain regions have content.

File

core/profiles/demo_umami/themes/umami/umami.theme, line 18
Functions to support theming in the Umami theme.

Code

function umami_preprocess_html(&$variables) {

  // Add a sidebar class if the sidebar has content in it.
  if (!empty($variables['page']['sidebar'])) {
    $variables['attributes']['class'][] = 'two-columns';
    $variables['#attached']['library'][] = 'umami/two-columns';
  }
  else {
    $variables['attributes']['class'][] = 'one-column';
  }
}