Skip to content

Commit

Permalink
Merge branch 'craft-3' of https://github.com/verbb/cp-nav into craft-3
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Feb 3, 2021
2 parents 9bfe0d0 + 37a6b5e commit e702eb6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/services/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,15 @@ public function populateOriginalNavigationItems($layoutId = 1)

private function _getOriginalNav()
{
// Just call it - we don't want the result of this function, we just want the hook called,
// which in turn calls our function above. Our hook will store the original nav in a private
// variable, for final use here. Might be a better way?
(new Cp())->nav();
// Allow CpNav services to be called by console requests
// https://github.com/verbb/cp-nav/issues/85
if(!Craft::$app->getRequest()->getIsConsoleRequest()) {

// Just call it - we don't want the result of this function, we just want the hook called,
// which in turn calls our function above. Our hook will store the original nav in a private
// variable, for final use here. Might be a better way?
(new Cp())->nav();
}

return $this->_originalNavItems;
}
Expand Down

0 comments on commit e702eb6

Please sign in to comment.