You are here

function multiversion_preprocess_html in Multiversion 8

Implements hook_preprocess_HOOK().

Adds the workspace as a class to the body.

File

./multiversion.module, line 635

Code

function multiversion_preprocess_html(&$variables) {
  $active_workspace = \Drupal::service('workspace.manager')
    ->getActiveWorkspace();
  if ($active_workspace && ($machine_name = $active_workspace
    ->getMachineName())) {

    // Add a new body class with the active workspace.
    $variables['attributes']['class'][] = 'workspace-' . $machine_name;
  }
}