You are here

protected function LanguageSwitcherLinkProcessor::hideCurrentLanguage in Language Switcher Extended 8

Hides the link to the current language.

Parameters

array $links: Language switcher links to be processed.

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

File

src/LanguageSwitcherLinkProcessor.php, line 165

Class

LanguageSwitcherLinkProcessor
Processes the Language Switcher links.

Namespace

Drupal\language_switcher_extended

Code

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

  // Remove the links to the current language.
  unset($links[$currentLanguage]);
}