You are here

function simple_login_settings in SimpleLogin 8.6

Implements settings for simple login pages.

4 calls to simple_login_settings()
simplelogin_css_alter in ./simplelogin.module
Implements hook_css_alter().
simplelogin_page_attachments in ./simplelogin.module
Implements hook_page_attachments
simplelogin_preprocess_html in ./simplelogin.module
Implements hook_preprocess_html() for page--simplelogin.tpl.php.
simplelogin_preprocess_simplelogin in ./simplelogin.module

File

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

Code

function simple_login_settings($arguments) {
  $simplelogin_settings = \Drupal::config('simplelogin.settings');
  $background_active = $simplelogin_settings
    ->get('background_active', '');
  $background_image = $simplelogin_settings
    ->get('background_image', '');
  $background_opacity = $simplelogin_settings
    ->get('background_opacity', '');
  $background_color = $simplelogin_settings
    ->get('background_color', '');
  $wrapper_width = $simplelogin_settings
    ->get('wrapper_width', '');
  $unset_active_css = $simplelogin_settings
    ->get('unset_active_css', '');
  $unset_css = $simplelogin_settings
    ->get('unset_css', '');
  switch ($arguments) {
    case "color":
      $simplelogin = $background_color ? $background_color : '#00bfff';
      break;
    case "image":
      $fileRelativePath = '';
      if (isset($background_image[0])) {
        $file = File::load($background_image[0]);

        // File Load
        if ($file) {
          $fileUrl = $file
            ->getFileUri();
          $fileRelativePath = file_url_transform_relative(file_create_url($fileUrl));
        }
      }
      $simplelogin = $fileRelativePath;
      break;
    case "opacity":
      $simplelogin = $background_opacity && $background_active ? 1 : '';
      break;
    case "active":
      $simplelogin = $background_active ? 'active' : '';
      break;
    case "width":
      $simplelogin = $wrapper_width ? $wrapper_width : '360';
      break;
    case 'unset_active_css':
      $simplelogin = $unset_active_css ? $unset_active_css : '';
      break;
    case "unset_css":
      $simplelogin = $unset_css ? $unset_css : '';
      break;
    default:
      $simplelogin = '';
  }
  return $simplelogin;
}