You are here

protected function LanguageSwitcherLinkProcessor::hideCurrentLanguageLink in Language Switcher Extended 8

Display the current language without link.

Parameters

array $links: Language switcher links to be processed.

1 call to LanguageSwitcherLinkProcessor::hideCurrentLanguageLink()
LanguageSwitcherLinkProcessor::process in src/LanguageSwitcherLinkProcessor.php
Processes the language switcher links.

File

src/LanguageSwitcherLinkProcessor.php, line 180

Class

LanguageSwitcherLinkProcessor
Processes the Language Switcher links.

Namespace

Drupal\language_switcher_extended

Code

protected function hideCurrentLanguageLink(array &$links) {
  $currentLanguage = $this->languageManager
    ->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
    ->getId();

  // Display the current language without link.
  unset($links[$currentLanguage]['url']);
  $links[$currentLanguage]['attributes']['class'][] = 'is-active';
}