Note that there are some explanatory texts on larger screens.

plurals
  1. POZend2 Navigation - Render Level 1 Branch Head + Children if active
    primarykey
    data
    text
    <p>I created a menu in zend2 which works so far. Perfectly.</p> <pre><code>- Parent 1 -- Child Page 1 -- Child Page 2 -- Child Page 3 - Parent 2 -- Child Page 1 -- Child Page 2 -- Child Page 3 - Parent 3 -- Child Page 1 -- Child Page 2 -- Child Page 3 </code></pre> <p>Now I'd like to only render child pages when the parent is active. Let's say Parent 2 would be active the rendered menu would look like this:</p> <pre><code>- Parent 1 - Parent 2 -- Child Page 1 -- Child Page 2 -- Child Page 3 - Parent 3 </code></pre> <p>That's my global.php config file</p> <pre><code>return array( 'navigation' =&gt; array( 'default' =&gt; array( array( 'label' =&gt; 'Parent 1', 'controller' =&gt; 'controllerone', 'pages' =&gt; array( array( 'label' =&gt; 'Page1', 'controller' =&gt; 'controllerone', 'action' =&gt; 'page-one', ), array( 'label' =&gt; 'Page2', 'controller' =&gt; 'controllerone', 'action' =&gt; 'page-two', ), array( 'label' =&gt; 'Page3', 'controller' =&gt; 'controllerone', 'action' =&gt; 'page-one', ) ), ), array( 'label' =&gt; 'Parent 2', 'controller' =&gt; 'controllertwo', 'pages' =&gt; array( array( 'label' =&gt; 'Page1', 'controller' =&gt; 'controllertwo', 'action' =&gt; 'page-one', ), array( 'label' =&gt; 'Page2', 'controller' =&gt; 'controllertwo', 'action' =&gt; 'page-two', ), array( 'label' =&gt; 'Page3', 'controller' =&gt; 'controllertwo', 'action' =&gt; 'page-one', ) ), ), array( 'label' =&gt; 'Parent 3', 'controller' =&gt; 'controllerthree', 'pages' =&gt; array( array( 'label' =&gt; 'Page1', 'controller' =&gt; 'controllerthree', 'action' =&gt; 'page-one', ), array( 'label' =&gt; 'Page2', 'controller' =&gt; 'controllerthree', 'action' =&gt; 'page-two', ), array( 'label' =&gt; 'Page3', 'controller' =&gt; 'controllerthree', 'action' =&gt; 'page-one', ) ), ), ) ), 'service_manager' =&gt; array( 'factories' =&gt; array( 'navigation' =&gt; 'Zend\Navigation\Service\DefaultNavigationFactory', ), ), ); </code></pre> <p>That's how i render the navigation within my layout</p> <pre><code>&lt;?php echo $this -&gt;navigation('navigation') -&gt;menu(); ?&gt; </code></pre> <p>Any help would be much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload