parent
94a3767bda
commit
35f3776752
1 changed files with 16 additions and 8 deletions
|
@ -109,6 +109,7 @@ function agarica_languague_switch_link() {
|
||||||
$links_render_array = [];
|
$links_render_array = [];
|
||||||
// Transform the links to arrays that can be renderer.
|
// Transform the links to arrays that can be renderer.
|
||||||
foreach ($links as $language => $link) {
|
foreach ($links as $language => $link) {
|
||||||
|
if (isset($link['url'])) {
|
||||||
$links_render_array[] = [
|
$links_render_array[] = [
|
||||||
'#type' => 'link',
|
'#type' => 'link',
|
||||||
'#url' => $link['url'],
|
'#url' => $link['url'],
|
||||||
|
@ -117,6 +118,13 @@ function agarica_languague_switch_link() {
|
||||||
'language' => $link['language'],
|
'language' => $link['language'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
} else {
|
||||||
|
// If there's no URL, we take only the title and don't try to make a link.
|
||||||
|
$links_render_array[] = [
|
||||||
|
'#type' => 'markup',
|
||||||
|
'#markup' => $link['title'],
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $links_render_array;
|
return $links_render_array;
|
||||||
|
|
Loading…
Reference in a new issue