inserting autonav, automatically?
Permalink
Hi - I've got a package here where I've figured out how to add a single page during the installation and add the single page the sitemap. However, when you navigate to that new page after install, the autonav element is gone.
Can anyone provide me with the code I need in order to add the autonav block onto this new single page during the package install?
Many thanks!!
Can anyone provide me with the code I need in order to add the autonav block onto this new single page during the package install?
Many thanks!!
The code below works upon initial install but there are a couple of issues that crop up:
It inserts the autonav block into the page, but for some reason it uses a different css class. The original pages all use class="nav-header", but this new block uses class="nav". Weird??
Secondly, I tried changing the theme to see what would happen. The autonav block disappeared from the page after the theme change. Is this a bug?
$bt = BlockType::getByHandle('autonav'); $data = array(); $data['orderBy'] = 'display_asc'; $data['displayPages'] = 'top'; $data['displaySubPages'] = 'none'; $c = Page::getByPath('/sermons'); $c->addBlock($bt, 'Header Nav', $data);
It inserts the autonav block into the page, but for some reason it uses a different css class. The original pages all use class="nav-header", but this new block uses class="nav". Weird??
Secondly, I tried changing the theme to see what would happen. The autonav block disappeared from the page after the theme change. Is this a bug?
i took that out of the dev docs
im not sure what the auto nav handle is or the option variables in it but it would be something like this i think:
this adds the autonav block to an area called Main.
Hope this helps
Mike