You are here

function context_preprocess_html in Context 8

Same name and namespace in other branches
  1. 8.4 context.module \context_preprocess_html()
  2. 8.0 context.module \context_preprocess_html()
  3. 7.3 context.core.inc \context_preprocess_html()

Run the body class context reactions if there are any and let them add classes to the page body.

Implements hook_preprocess_HOOK().

File

./context.module, line 35

Code

function context_preprocess_html(&$variables) {

  /** @var \Drupal\context\ContextManager $context_manager */
  $context_manager = \Drupal::service('context.manager');
  foreach ($context_manager
    ->getActiveReactions('body_class') as $reaction) {
    $variables['attributes'] = NestedArray::mergeDeep($variables['attributes'], $reaction
      ->execute());
  }
}