function umami_preprocess_html

Same name in other branches
  1. 9 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_html()
  2. 10 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_html()
  3. 11.x 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 17

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';
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.