You are here

function purl_preprocess_html in Persistent URL 8

Implements hook_preprocess_html().

File

./purl.module, line 54

Code

function purl_preprocess_html(&$vars) {
  $init = \Drupal::requestStack();
  $request = $init
    ->getCurrentRequest();
  $modifiers = $request->attributes
    ->get('purl.matched_modifiers', []);
  foreach ($modifiers as $modifier) {
    foreach ($modifier as $key => $item) {
      if (!is_object($item)) {
        $vars['attributes']['class'][] = 'purl-' . $key . '-' . $item;
      }
    }
  }
}