function gin_login_preprocess_html in Gin Login 8
Implements hook_preprocess_HOOK() for html.
File
- ./
gin_login.module, line 62 - gin_login.module
Code
function gin_login_preprocess_html(&$variables) {
if (_gin_login__check_path() && _gin_login_gin_is_active()) {
$theme = \Drupal::theme()
->getActiveTheme()
->getName();
// Get theme darkmode config.
$darkmode = theme_get_setting('enable_darkmode', $theme);
$preset_accent_color = theme_get_setting('preset_accent_color', $theme);
$high_contrast_mode = theme_get_setting('high_contrast_mode', $theme);
// We need to check both because of backwards compatibility.
if ($darkmode === TRUE || $darkmode === 1) {
$variables['attributes']['class'][] = 'gin--dark-mode';
}
// Set accent color.
if ($preset_accent_color) {
$variables['attributes']['data-gin-accent'] = $preset_accent_color;
}
// High contast mode.
if ($high_contrast_mode === TRUE) {
$variables['attributes']['class'][] = 'gin--high-contrast-mode';
}
}
}