am-impact / amnav

Navigation plugin for Craft
168 stars 19 forks source link

Add 'parentUrl' functionality #13

Closed ceephax closed 9 years ago

ceephax commented 9 years ago

I was looking for a way for my blog entries to make their parent pages 'active' in the navigation (eg my blog listing page).

I added a new 'parentUrl' parameter which is then put to use in the _isPageActive function in AmNavService.php.

First couple of lines are changed to as follows:

$path = $this->_getParam('parentUrl', craft()->request->getPath()); $segments = $this->_getParam('parentUrl', false) ? explode("/",$this->_getParam('parentUrl', false)) : craft()->request->getSegments();

And then it's used like so:

{{ craft.amNav.getNav("primaryNavigation", { classFirst: 'first', maxLevel: 2, excludeUl: true, classActive: 'active', parentUrl: 'support-resources/blog' }) }}

I was hoping you could add this as a proper feature, with probably a better name than parentUrl.

Thanks

hubertprein commented 9 years ago

Sorry for the late reply, but I was wondering if this issue isn't already resolved?

If not, could you please be more specific about what you want to achieve here?