public function LanguageApi::languageLinks in Little helpers 7
Same name and namespace in other branches
- 7.2 src/Locale/LanguageApi.php \Drupal\little_helpers\Locale\LanguageApi::languageLinks()
Give paths to all (or a subset) of the available translations.
File
- src/
Locale/ LanguageApi.php, line 38
Class
Namespace
Drupal\little_helpers\LocaleCode
public function languageLinks($languages = NULL, $path = NULL) {
if (!$languages) {
$languages = \language_list();
}
if (!$path) {
$path = \current_path();
}
$currentLanguage = $this
->currentLanguage();
$links = array();
$switchLinks = $this
->switchLinks($path);
foreach ($languages as $code => $language) {
if ($code == $currentLanguage) {
continue;
}
if (isset($switchLinks[$code]) && isset($switchLinks[$code]['href']) && $this
->checkAccess($switchLinks[$code]['href'], $code)) {
$links[$code] = $switchLinks[$code];
}
}
return $links;
}