Skip to content

Commit

Permalink
Fix for #73
Browse files Browse the repository at this point in the history
  • Loading branch information
janhenckens committed May 3, 2024
1 parent bf7675f commit 7defcb8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/services/NodesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getNodesByNavId($navId = null)
}


public function getNodesForRender($navHandle, $site)
public function getNodesForRender($navHandle, $siteId)
{
Craft::beginProfile('getNodesForRender', __METHOD__);
$nav = Navigate::$plugin->navigate->getNavigationByHandle($navHandle);
Expand All @@ -71,7 +71,7 @@ public function getNodesForRender($navHandle, $site)
}

if (Craft::$app->getConfig()->getGeneral()->devMode || Navigate::getInstance()->getSettings()->disableCaching) {
$nodes = $this->getNodesByNavIdAndSiteById($site, $nav->id, true, true);
$nodes = $this->getNodesByNavIdAndSiteById($nav->id, $siteId, true, true);
$nodes = $this->parseNodesForRender($nodes, $nav);
return $nodes;
} else {
Expand All @@ -80,13 +80,13 @@ public function getNodesForRender($navHandle, $site)
self::NAVIGATE_CACHE,

self::NAVIGATE_CACHE_NODES,
self::NAVIGATE_CACHE_NODES . '_' . $nav->handle . '_' . $site,
self::NAVIGATE_CACHE_NODES . '_' . $nav->handle . '_' . $siteId,
],
]);
$nodes = Craft::$app->getCache()->getOrSet(
self::NAVIGATE_CACHE_NODES . '_' . $nav->handle . '_' . $site,
function() use ($nav, $site) {
$nodes = $this->getNodesByNavIdAndSiteById($nav->id, $site, true, true);
self::NAVIGATE_CACHE_NODES . '_' . $nav->handle . '_' . $siteId,
function() use ($nav, $siteId) {
$nodes = $this->getNodesByNavIdAndSiteById($nav->id, $siteId, true, true);
$nodes = $this->parseNodesForRender($nodes, $nav);
return $nodes;
},
Expand Down

0 comments on commit 7defcb8

Please sign in to comment.