Hello,
I’m using wayfinder to create the pagetrail - I’ve 4 folders as language containers - the folders are published but not shown in the menu.
when creating the page trail, I have two issues: first, the home link should refer to the welcome page withing the corresponding language container. second, when I’m on the welcome page, I don’t want to show the home link.
I found a solution for the second issue:
$homeIds = array(46,47,48,49);
$parentId = $modx->runSnippet('UltimateParent');
//if ($modx->config['site_start'] == $modx->documentObject['id']) {
if (in_array($modx->documentObject['id'], $homeIds)) {
$homeLink = '';
} else {
$homeLink = "<li><a class=\"home\" href=\"{$modx->config['site_url']}\" title=\"Home\">Home</a></li> ".$separator." ";
}
I created an array ($homeIds) with the id of the welcome pages of the four different languages - if the current document id is in the $homeIds array, I don’t show the home link.
for the first id, I couldn’t find a solution yet due to my limited programming skills. what I was thinking is that I could get the ultimate parent of the current document. then I could try to figure out what id in the $homeIds is a child of the current ultimate parent. Unfortunately, I don’t know how to do this. maybe there is also an easier way to solve the two issues I’m having.
In this context, how could I get for instance the alias of a document with a given id - is there some api stuff to do this?
I hope somebody can help.
thank you in advance for your input.