public function Language::getLinks in Config Pages 8.3
Same name and namespace in other branches
- 8.2 src/Plugin/ConfigPagesContext/Language.php \Drupal\config_pages\Plugin\ConfigPagesContext\Language::getLinks()
Get array of available links to switch on given context.
Return value
array Return array of available links to switch on given context.
Overrides ConfigPagesContextBase::getLinks
File
- src/
Plugin/ ConfigPagesContext/ Language.php, line 75
Class
- Language
- Provides a language config pages context.
Namespace
Drupal\config_pages\Plugin\ConfigPagesContextCode
public function getLinks() {
$links = [];
$value = $this
->getValue();
$languages = $this->languageManager
->getLanguages();
foreach ($languages as $lang) {
$links[] = [
'title' => $lang
->getName(),
'href' => Url::fromRoute('<current>', [], [
'language' => $lang,
]),
'selected' => $value == $lang
->getId() ? TRUE : FALSE,
'value' => $lang
->getId(),
];
}
return $links;
}