You are here

function seven_preprocess_html in Drupal 8

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

Implements hook_preprocess_HOOK() for HTML document templates.

File

core/themes/seven/seven.theme, line 17
Functions to support theming in the Seven theme.

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