How to add page handle as class name in Auto Nav?
The code below is from view.php from Autonav block. In the code below I've used $ni->getName() as class name but I want something like $ni->getHandle() - but this is not part of AutonavBlockItem.
Another alternative I can think of is to explode $ni->getURL() and get the last part of the url but I was wondering if there is a cleaner way to do this.
echo('<li class="'.$ni->getName().'"><a href="' . $pageLink . '" ' . $target . ' >' . $ni->getName() . '</a>');
$handle = $page->getCollectionHandle();
Inside of an autonav block, I believe it would be...
$handle = $ni->cObj->getCollectionHandle();
Fatal error: Call to a member function getCollectionHandle()on a non-object in C:\Program Files\xampp1.7.7\htdocs\test\blocks\autonav\templates\header_menu_dropdown.php on line 72
What version of Concrete5 are you using?
Anyway I've figured it out. I had to use $_c->getCollectionHandle() inside autonav block template.
echo('<li class="'.$_c->getCollectionHandle().'"><a href="' . $pageLink . '" ' . $target . ' >' . $ni->getName() . '</a>');