You are here

function hidden_language_language_switch_links_alter in Hidden Language 7

Same name and namespace in other branches
  1. 8 hidden_language.module \hidden_language_language_switch_links_alter()
  2. 2.x hidden_language.module \hidden_language_language_switch_links_alter()

Implements hook_language_switch_links_alter().

File

./hidden_language.module, line 69

Code

function hidden_language_language_switch_links_alter(&$links, $type, $path) {
  $languages = language_list('enabled');
  foreach ($languages[1] as $language) {
    $langcode = $language->language;
    $access_hidden_language = user_access('access all hidden languages') || user_access("access hidden language {$langcode}");
    if ($language->hidden && isset($links[$langcode]) && !$access_hidden_language) {
      unset($links[$langcode]);
    }
  }
}