function claro_preprocess_links

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

Implements hook_preprocess_HOOK() for links.

File

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

Code

function claro_preprocess_links(&$variables) {
    foreach ($variables['links'] as $links_item) {
        if (!empty($links_item['link']) && !empty($links_item['link']['#url']) && $links_item['link']['#url'] instanceof Url) {
            if ($links_item['link']['#url']->isRouted()) {
                switch ($links_item['link']['#url']->getRouteName()) {
                    case 'system.theme_settings_theme':
                        $links_item['link'] = _claro_convert_link_to_action_link($links_item['link'], 'cog', 'small');
                        break;
                    case 'system.theme_uninstall':
                        $links_item['link'] = _claro_convert_link_to_action_link($links_item['link'], 'ex', 'small');
                        break;
                    case 'system.theme_set_default':
                    case 'system.theme_install':
                        $links_item['link'] = _claro_convert_link_to_action_link($links_item['link'], 'checkmark', 'small');
                        break;
                }
            }
        }
    }
}

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