You are here

function simplelogin_theme_suggestions_alter in SimpleLogin 8.6

Implements hook_theme_suggestions_alter

File

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

Code

function simplelogin_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
  if ($hook == 'page') {
    $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)) {
        $suggestions[] = 'page__simplelogin';
      }
    }
  }
}