function gin_login_preprocess_ginlogin in Gin Login 8
Implements hook_preprocess_HOOK().
1 string reference to 'gin_login_preprocess_ginlogin'
- gin_login_theme in ./
gin_login.module - Theme()
File
- ./
gin_login.module, line 181 - gin_login.module
Code
function gin_login_preprocess_ginlogin(&$variables) {
$theme = \Drupal::theme()
->getActiveTheme()
->getName();
$darkmode = theme_get_setting('enable_darkmode', $theme);
$useDefaultIcon = theme_get_setting('icon_default', $theme);
$ginIconPath = theme_get_setting('icon_path', $theme);
$config = \Drupal::config('gin_login.settings');
$variables['site_name'] = \Drupal::config('system.site')
->get('name');
if (!$darkmode) {
$default_logo = '/images/gin.svg';
}
else {
$default_logo = '/images/gin_darkmode.svg';
}
if (!$useDefaultIcon && !empty($ginIconPath)) {
$variables['logo'] = file_create_url($ginIconPath);
}
else {
$defaultLogo = drupal_get_path('module', 'gin_login') . $default_logo;
$variables['logo'] = file_create_url($defaultLogo);
}
$configData = $config
->get();
if ($configData['logo']['use_default'] == "0") {
if (isset($configData['logo']['path']) && !empty($configData['logo']['path'])) {
$variables['logo'] = file_create_url($configData['logo']['path']);
}
}
$variables['brand_image'] = '//source.unsplash.com/collection/9407737';
$variables['brand_alt'] = 'Random image from unsplash';
if ($configData['brand_image']['use_default'] == "0") {
if (isset($configData['brand_image']['path']) && !empty($configData['brand_image']['path'])) {
$variables['brand_image'] = file_create_url($configData['brand_image']['path']);
$variables['brand_alt'] = '';
}
}
}