You are here

function simplelogin_preprocess_html in SimpleLogin 8.6

Same name and namespace in other branches
  1. 7 simplelogin.module \simplelogin_preprocess_html()

Implements hook_preprocess_html() for page--simplelogin.tpl.php.

File

./simplelogin.module, line 35
The module file for simplelogin pages module.

Code

function simplelogin_preprocess_html(&$variables) {
  $path = \Drupal::service('path.current')
    ->getPath();
  $user_path = array(
    '/user',
    '/user/login',
    '/user/password',
    '/user/register',
  );
  $current_user = \Drupal::currentUser();

  // Whether the current user is anonymous or authenticated
  if (!$current_user
    ->id()) {
    if (in_array($path, $user_path)) {
      $variables['attributes']['class'][] = 'simplelogin';
      $background_opacity = simple_login_settings('opacity');
      if ($background_opacity) {
        $variables['attributes']['class'][] = 'opacity';
      }
    }
  }
}