studioespresso / craft-navigate

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.
https://plugins.craftcms.com/navigate
Other
26 stars 7 forks source link

Multiple navigations -> Only first is showing #73

Closed robin-braibant-alpine closed 6 months ago

robin-braibant-alpine commented 6 months ago

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.

janhenckens commented 6 months ago

Good catch! And thanks for the detailed report 🙏

This is fixed in 5.1.1, which is out now.