AutoNav sections

Permalink
I am trying to figure out a way that an AutoNav item is just a placeholder link to open the list of subpages without navigating away from the current page.

I know I can add the "replace_link_with_first_in_nav" handle to have the AutoNav jump the user to the first child instead of showing the content of the actual page but I would rather keep the user on the current page. The effect would be to simply expand this section of the AutoNav.

I have checked the AutoNav code and I don't see any provisions for it...

Thanks

anda
 
firepixel replied on at Permalink Reply
firepixel
You can add a new attribute like 'dont_link_menu_item' and then make a autonav template and add the middle IF statement below. I do this all the time!

if ($_c->getCollectionAttributeValue('replace_link_with_first_in_nav')) {
   $subPage = $_c->getFirstChild();
   if ($subPage instanceof Page) {
   $pageLink = $nh->getLinkToCollection($subPage);
   }
}
if (!$pageLink) {
     if($_c->getCollectionAttributeValue('dont_link_menu_item')){
         $pageLink = "javascript:void(0)";
     }
     else
         $pageLink = $ni->getURL();
}                        
if (!$pageLink) {
   $pageLink = $ni->getURL();
kirks replied on at Permalink Reply
kirks
Hi, I'm a newbie and trying to figure all this stuff out. I see where to add a new attribute but where to I add the code you provided for the dont_link_menu_item?
firepixel replied on at Permalink Reply
firepixel
first make a copy of the autonav view.php from the /concrete/blocks/autonav folder

then you have to make a new folder /blocks/autonav/template (you have to create the autonav folder also.

Place the view.php in that folder and rename it to something like my_template.php.

Then you edit the page and click the block to change the custom template. Your new template should appear in the list!