You are here

function at_tools_preprocess_system_themes_page in AT Tools 8.3

Same name and namespace in other branches
  1. 8 at_tools.module \at_tools_preprocess_system_themes_page()
  2. 8.2 at_tools.module \at_tools_preprocess_system_themes_page()

Prepares variables for appearance page templates.

Default template: system-themes-page.html.twig.

Parameters

$variables: An associative array containing:

  • theme_groups: An associative array containing groups of themes.
  • theme_group_titles: An associative array containing titles of themes.

File

./at_tools.module, line 21
Contains at_tools.module

Code

function at_tools_preprocess_system_themes_page(&$variables) {
  $variables['#attached']['library'][] = 'at_tools/appearance_settings';
  $theme_groups = $variables['theme_groups'];
  foreach ($theme_groups as $group_key => $theme_group) {
    foreach ($theme_group['themes'] as $theme_key => $theme) {
      foreach ($theme as $t => $theme_values) {

        // Add a class to each "theme-selector" wrapper.
        $variables['theme_groups'][$group_key]['themes'][$theme_key]['attributes']
          ->addClass(Html::cleanCssIdentifier(strtolower($theme['name'])));
      }
    }
  }
}