You are here

public function Html::preprocessVariables in Open Social 8.9

Same name and namespace in other branches
  1. 8.8 themes/socialblue/src/Plugin/Preprocess/Html.php \Drupal\socialblue\Plugin\Preprocess\Html::preprocessVariables()

Preprocess the variables array.

Parameters

\Drupal\bootstrap\Utility\Variables $variables: The Variables object.

Overrides PreprocessBase::preprocessVariables

File

themes/socialblue/src/Plugin/Preprocess/Html.php, line 36

Class

Html
Pre-processes variables for the "html" theme hook.

Namespace

Drupal\socialblue\Plugin\Preprocess

Code

public function preprocessVariables(Variables $variables) {

  // Add style class to html body.
  $style = theme_get_setting('style');
  if (!empty($style)) {
    $variables['attributes']['class'][] = 'socialblue--' . $style;
    $route_match = \Drupal::routeMatch();

    // For SKY when we are on edit user or edit profile
    // we want to distinct the root_path with a better class name
    // this is used in html.html.twig.
    if ($route_match
      ->getParameter('user') && $route_match
      ->getRouteName() === 'profile.user_page.single' || $route_match
      ->getRouteName() === 'entity.user.edit_form') {
      $variables['root_path'] = 'user-edit';
    }
  }
  parent::preprocessVariables($variables);
}