function hidden_language_language_switch_links_alter in Hidden Language 8
Same name and namespace in other branches
- 7 hidden_language.module \hidden_language_language_switch_links_alter()
- 2.x hidden_language.module \hidden_language_language_switch_links_alter()
Implements hook_language_switch_links_alter().
Hide links to hidden languages.
File
- ./
hidden_language.module, line 53
Code
function hidden_language_language_switch_links_alter(array &$links, $type, $path) {
$languages = \Drupal::languageManager()
->getLanguages();
/** @var ConfigurableLanguage[] $languages */
$languages = ConfigurableLanguage::loadMultiple(array_keys($languages));
foreach ($languages as $langcode => $language) {
if ($language
->getThirdPartySetting('hidden_language', 'hidden', FALSE)) {
unset($links[$langcode]);
}
}
}