function gin_login_page_attachments_alter in Gin Login 8
Page_attachments_alter()
File
- ./
gin_login.module, line 14 - gin_login.module
Code
function gin_login_page_attachments_alter(&$page) {
if (_gin_login__check_path()) {
if (_gin_login_gin_is_active()) {
$theme = \Drupal::theme()
->getActiveTheme()
->getName();
// Get theme configs.
$darkmode = theme_get_setting('enable_darkmode', $theme);
$preset_accent_color = theme_get_setting('preset_accent_color', $theme);
$accent_color = theme_get_setting('accent_color', $theme);
$preset_focus_color = theme_get_setting('preset_focus_color', $theme);
$focus_color = theme_get_setting('focus_color', $theme);
$highcontrastmode = theme_get_setting('high_contrast_mode', $theme);
// Define darkmode class.
$darkmode_class = 'gin--dark-mode';
$highcontrastmode_class = 'gin--high-contrast-mode';
// Attach the init script.
$page['#attached']['library'][] = 'gin/gin_init';
// Attach Gin styles.
$page['#attached']['library'][] = 'gin/gin';
// Attach accent overrides CSS.
$page['#attached']['library'][] = 'gin/gin_accent';
// Attach custom Gin overrides
if (file_exists('public://gin-custom.css')) {
$page['#attached']['library'][] = 'gin/gin_custom_css';
}
// Expose settings to JS.
$page['#attached']['drupalSettings']['gin']['darkmode'] = $darkmode;
$page['#attached']['drupalSettings']['gin']['darkmode_class'] = $darkmode_class;
$page['#attached']['drupalSettings']['gin']['preset_accent_color'] = $preset_accent_color;
$page['#attached']['drupalSettings']['gin']['accent_color'] = $accent_color;
$page['#attached']['drupalSettings']['gin']['preset_focus_color'] = $preset_focus_color;
$page['#attached']['drupalSettings']['gin']['focus_color'] = $focus_color;
$page['#attached']['drupalSettings']['gin']['highcontrastmode'] = $highcontrastmode;
$page['#attached']['drupalSettings']['gin']['highcontrastmode_class'] = $highcontrastmode_class;
}
// Check if path is available and we're at user level.
$page['#attached']['library'][] = 'gin_login/gin_login';
}
}