getBuildInfo()['callback_object']->getEntity(); $enabledUserOverrides = $form_state->getValue('enable_user_settings'); /** @var \Drupal\gin\GinSettings $settings */ $settings = \Drupal::classResolver(GinSettings::class); if ($enabledUserOverrides) { $user_settings = [ 'enable_darkmode' => $form_state->getValue('enable_darkmode'), 'preset_accent_color' => $form_state->getValue('preset_accent_color'), 'accent_color' => $form_state->getValue('accent_color'), 'classic_toolbar' => $form_state->getValue('classic_toolbar'), 'preset_focus_color' => $form_state->getValue('preset_focus_color'), 'focus_color' => $form_state->getValue('focus_color'), 'high_contrast_mode' => (bool) $form_state->getValue('high_contrast_mode'), 'layout_density' => $form_state->getValue('layout_density'), 'show_description_toggle' => $form_state->getValue('show_description_toggle'), ]; $settings->setAll($user_settings, $account); } else { $settings->clear($account); } } /** * Helper function for check if Gin is active. */ function _gin_is_active() { $theme_handler = \Drupal::service('theme_handler')->listInfo(); // Check if set as frontend theme. $frontend_theme_name = \Drupal::config('system.theme')->get('default'); // Check if base themes are set. if (isset($theme_handler[$frontend_theme_name]->base_themes)) { $frontend_base_themes = $theme_handler[$frontend_theme_name]->base_themes; } // Add theme name to base theme array. $frontend_base_themes[$frontend_theme_name] = $frontend_theme_name; // Check if set as admin theme. $admin_theme_name = \Drupal::config('system.theme')->get('admin'); // Admin theme will have no value if it is set to use the default theme. if ($admin_theme_name && isset($theme_handler[$admin_theme_name]->base_themes)) { $admin_base_themes = $theme_handler[$admin_theme_name]->base_themes; $admin_base_themes[$admin_theme_name] = $admin_theme_name; } else { $admin_base_themes = $frontend_base_themes; } $base_themes = array_merge($admin_base_themes, $frontend_base_themes); $gin_activated = array_key_exists('gin', $base_themes); return $gin_activated; }