You are here

function claro_preprocess_links in Drupal 8

Same name and namespace in other branches
  1. 9 core/themes/claro/claro.theme \claro_preprocess_links()
  2. 10 core/themes/claro/claro.theme \claro_preprocess_links()

Implements hook_preprocess_HOOK() for links.

File

core/themes/claro/claro.theme, line 383
Functions to support theming in the Claro theme.

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;
        }
      }
    }
  }
}