Navigate makes adding and maintaining menu's and navigations a breeze. Set what types of links a menu may contain, make multi-level navigations, built-in active-state check, custom classes per item.
I was using the plugin (version 5.1.0) and added multiple navigations. The first one was showing without a problem, but when I called the second one in the Twig code I always got an empty array as a result.
I went looking for the problem and I think I found the issue in the code. In the NodesService you are calling the following method on line 74:
$nodes = $this->getNodesByNavIdAndSiteById($site, $nav->id, true, true);
You are passing $site and $nav->id but the signature of the method (on line 185) is different:
public function getNodesByNavIdAndSiteById($navId = null, $siteId = null, $refresh = false, $excludeDisabled = false).
So when calling the method, the navId has to be passed first and then the $site.
Hi Jan
I was using the plugin (version 5.1.0) and added multiple navigations. The first one was showing without a problem, but when I called the second one in the Twig code I always got an empty array as a result.
I went looking for the problem and I think I found the issue in the code. In the NodesService you are calling the following method on line 74:
$nodes = $this->getNodesByNavIdAndSiteById($site, $nav->id, true, true);
You are passing
$site
and$nav->id
but the signature of the method (on line 185) is different:public function getNodesByNavIdAndSiteById($navId = null, $siteId = null, $refresh = false, $excludeDisabled = false)
.So when calling the method, the
navId
has to be passed first and then the$site
.