Programmatically display autoNav block but ignore the exclude nav attribute
Permalink
Hi All,
I am trying to programmatically output a full page list of all pages in hierarchical order.
My topnav has some pages hidden as i dont want every page in my topnav but I do want to list every page for this feature im developing.
I can see that the variable ignoreExcludeNav is being changed from false to true, but the excluded pages aren't being listed for some reason.
I am wondering if there is a specific way I have to set block class variables?
I am trying to programmatically output a full page list of all pages in hierarchical order.
My topnav has some pages hidden as i dont want every page in my topnav but I do want to list every page for this feature im developing.
I can see that the variable ignoreExcludeNav is being changed from false to true, but the excluded pages aren't being listed for some reason.
I am wondering if there is a specific way I have to set block class variables?
$nav = \BlockType::getByHandle('autonav'); var_dump($nav->controller->ignoreExcludeNav); $nav->controller->ignoreExcludeNav = true; var_dump($nav->controller->ignoreExcludeNav); $nav->controller->orderBy = 'display_asc'; $nav->controller->displayPages = 'top'; $nav->controller->displaySubPages = 'all'; $nav->controller->displaySubPageLevels = 'custom'; $nav->controller->displaySubPageLevelsNum = 2; $nav->render('view');
and then set that custom template on your block call