function claro_preprocess_system_themes_page

Same name in other branches
  1. 9 core/themes/claro/claro.theme \claro_preprocess_system_themes_page()
  2. 8.9.x core/themes/claro/claro.theme \claro_preprocess_system_themes_page()
  3. 11.x core/themes/claro/claro.theme \claro_preprocess_system_themes_page()

Implements hook_preprocess_HOOK() for system_themes_page.

File

core/themes/claro/claro.theme, line 1258

Code

function claro_preprocess_system_themes_page(&$variables) {
    if (!empty($variables['theme_groups'])) {
        foreach ($variables['theme_groups'] as &$theme_group) {
            if (!empty($theme_group['themes'])) {
                foreach ($theme_group['themes'] as &$theme_card) {
                    
                    /**
                     * @todo Remove dependency on attributes after
                     *   https://www.drupal.org/project/drupal/issues/2511548 has been
                     *   resolved.
                     */
                    if (isset($theme_card['screenshot']['#attributes']) && $theme_card['screenshot']['#attributes'] instanceof Attribute && $theme_card['screenshot']['#attributes']->hasClass('no-screenshot')) {
                        unset($theme_card['screenshot']);
                    }
                    $theme_card['title_id'] = Html::getUniqueId($theme_card['name'] . '-label');
                    $description_is_empty = empty((string) $theme_card['description']);
                    // Set description_id only if the description is not empty.
                    if (!$description_is_empty) {
                        $theme_card['description_id'] = Html::getUniqueId($theme_card['name'] . '-description');
                    }
                    if (!empty($theme_card['operations']) && !empty($theme_card['operations']['#theme']) && $theme_card['operations']['#theme'] === 'links') {
                        $theme_card['operations']['#theme'] = 'links__action_links';
                    }
                }
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.