Code:
<?php $active_trail_items = menu_get_active_trail();
$top_level_title = $active_trail_items[1]['link_title'];
// $top_level_path = $active_trail_items[1]['link_path'];
// because global redirect is not working for i18n, find the path alias myself
$alias = drupal_get_path_alias($_GET['q']);
// make sure $remaining_path gets something (albeit NULL), otherwise eval will choke
list($top_level_path, $remaining_path) = explode('/', $alias, 2) + Array(NULL, NULL);
// including the langcode
global $language;
$lang_code = $language-?>language;
// because nl is the default, it goes without the langcode
if ($lang_code == 'nl') {
$top_level_full_path = '/'.$top_level_path;
}
else {
$top_level_full_path = '/'.$lang_code.'/'.$top_level_path;
}
// only print a link when you’re not on the top-level page itself
if ($remaining_path) {
$output = "<a href="$top_level_full_path">$top_level_title</a>";
}
else {
$output = "<span>$top_level_title</span>";
}
return $output;
?>
Project:
Type:
Reactie toevoegen