You are here

function simplelogin_preprocess_page in SimpleLogin 7

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

File

./simplelogin.module, line 11
The Login screens, which controls the customized background image.

Code

function simplelogin_preprocess_page(&$variables, $hook) {
  $path = drupal_get_path_alias();
  $user_path = array(
    'user',
    'user/login',
    'user/password',
    'user/register',
  );
  if (user_is_anonymous()) {
    if (in_array($path, $user_path)) {
      $array = array(
        'type' => 'file',
        'weight' => 999,
        'group' => CSS_THEME,
      );
      drupal_add_css(drupal_get_path('module', 'simplelogin') . "/css/simplelogin.css", $array);
      $variables['theme_hook_suggestions'][] = 'page__simplelogin';
      $variable = variable_get('simplelogin_fid', '');
      if ($variable) {
        $file = file_load($variable);
        $bgimg = file_create_url($file->uri);
        $css = "body.simplelogin {background-image: url('{$bgimg}') }";
        drupal_add_css($css, 'inline');
      }
    }
  }
}