You are here

function better_login_form_config_preprocess_page in Better Login Form Configuration 8

Implements hook_preprocess_page().

1 string reference to 'better_login_form_config_preprocess_page'
better_login_form_config_theme_registry_alter in better_login_form_config/better_login_form_config.module
Implements hook_theme_registry_alter().

File

better_login_form_config/better_login_form_config.module, line 91

Code

function better_login_form_config_preprocess_page(&$variables) {
  $variables['site_name'] = \Drupal::config('system.site')
    ->get('name');
  $variables['logo'] = theme_get_setting('logo.url');
  $current_path = \Drupal::service('path.current')
    ->getPath();
  $myConfig = \Drupal::config('fancy_login.settings');
  $variables['create_accounts'] = $myConfig
    ->get('create_account');
  $variables['forgot_password'] = $myConfig
    ->get('forgot_password');
  switch ($current_path) {
    case '/user/login':
      $variables['title'] = $myConfig
        ->get('form_title');
      if (empty($myConfig
        ->get('include_login'))) {
        $variables['page']['content']['bartik_local_tasks'] = array();
        $variables['page']['content']['bartik_page_title'] = array();
      }
      break;
    case '/user/password':
      $variables['title'] = t($myConfig
        ->get('forgot_form_title'));
      if (empty($myConfig
        ->get('include_forgot_template'))) {
        $variables['page']['content']['bartik_local_tasks'] = array();
        $variables['page']['content']['bartik_page_title'] = array();
      }
      break;
    case '/user/register':
      $variables['title'] = t($myConfig
        ->get('register_form_title'));
      if (empty($myConfig
        ->get('include_regi_template'))) {
        $variables['page']['content']['bartik_local_tasks'] = array();
        $variables['page']['content']['bartik_page_title'] = array();
      }
      break;
  }
  $variables['#cache']['contexts'][] = 'route';
  $variables['page']['#cache']['contexts'][] = 'route';
}