You are here

function brainstorm_theme_preprocess_page in Brainstorm profile 8

Same name and namespace in other branches
  1. 7 themes/brainstorm_theme/template.php \brainstorm_theme_preprocess_page()

Implements hook_preprocess_HOOK() for page.html.twig.

File

theme/brainstorm_theme/brainstorm_theme.theme, line 57
Process theme data.

Code

function brainstorm_theme_preprocess_page(&$variables) {
  if (isset($variables['node'])) {
    $variables['attributes']['class'][] = "page-title-" . $variables['node']
      ->id();
    $variables['attributes']['class'][] = "node-type-" . $variables['node']
      ->getType();
  }
  $current_path = \Drupal::request()
    ->getRequestUri();
  $url_fragments = explode('/', $current_path);
  if (count($url_fragments) < 3) {
    $variables['page_class'] = 'class=page-info';
  }
}