Closed christophlehmann closed 1 year ago
+1
I'm having the same problem with the overall v:menu viewhandler.
Turns out, if a page isn't translated or hidden, the resulting link's href-attribute was just empty.
I ended up editing vhs/Classes/ViewHelpers/Menu/AbstractMenuViewHelper.php
directly (I know, bad).
I changed renderItemLink
on line 353 to the following:
protected function renderItemLink(array $page)
{
$isSpacer = ($page['doktype'] === PageRepository::DOKTYPE_SPACER);
$isCurrent = (boolean) $page['current'];
$isActive = (boolean) $page['active'];
$linkCurrent = (boolean) $this->arguments['linkCurrent'];
$linkActive = (boolean) $this->arguments['linkActive'];
$includeAnchorTitle = (boolean) $this->arguments['includeAnchorTitle'];
$target = (!empty($page['target'])) ? ' target="' . $page['target'] . '"' : '';
$class = (trim($page['class']) !== '') ? ' class="' . trim($page['class']) . '"' : '';
/****
* hack!!!
* if the link is empty, the page is either hidden or not translated.
* Do NOT show it in the menu
*/
if ($page['link'] == '') {
return '';
}
if ($isSpacer || ($isCurrent && !$linkCurrent) || ($isActive && !$linkActive)) {
$html = htmlspecialchars($page['linktext']);
} elseif ($includeAnchorTitle) {
$html = sprintf(
'<a href="%s" title="%s"%s%s>%s</a>',
$page['link'],
htmlspecialchars($page['title']),
$class,
$target,
htmlspecialchars($page['linktext'])
);
} else {
$html = sprintf(
'<a href="%s"%s%s>%s</a>',
$page['link'],
$class,
$target,
htmlspecialchars($page['linktext'])
);
}
return $html;
}
Hope this has no side-effects…
How to reproduce
<v:menu.directory>
Misbehaviour: The menu contains the translated page.
The opposite case is also wrong (or lets say currently not supported), eg. when the page in default language has nav_hide=1 and its translation has nav_hide=0 then the translation is not in the menu.
Using different values for nav_hide by page and language is still valid