function seven_preprocess_html

Same name in other branches
  1. 7.x themes/seven/template.php \seven_preprocess_html()
  2. 8.9.x core/themes/seven/seven.theme \seven_preprocess_html()

Implements hook_preprocess_HOOK() for HTML document templates.

File

core/themes/seven/seven.theme, line 18

Code

function seven_preprocess_html(&$variables) {
    // If on a node add or edit page, add a node-layout class.
    $path_args = explode('/', \Drupal::request()->getPathInfo());
    if ($suggestions = theme_get_suggestions($path_args, 'page', '-')) {
        foreach ($suggestions as $suggestion) {
            if ($suggestion === 'page-node-edit' || strpos($suggestion, 'page-node-add') !== FALSE) {
                $variables['attributes']['class'][] = 'node-form-layout';
            }
        }
    }
}

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