This seems to be a similar problem but didn't work for me. I feel like the answer must be out there -- this can't be an uncommon issue -- but I'm not using the correct search terms.
ZF2: Active branch for child routes in zend navigation. How?
Here is a route I have defined:
'router' => array(
'routes' => array(
'platform' => array(
'type' => 'segment',
'options' => array(
'route' => '/platform[/:controller/:region/:id[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'region' => '[0-9a-z]{2,4}',
'id' => '[0-9a-z-]+',
),
'defaults' => array(
'controller' => 'platform',
'action' => 'index',
),
),
),
),
),
And here is my navigation:
'navigation' => array(
'default' => array(
array(
'label' => 'Home',
'route' => 'home',
),
array(
'label' => 'Account',
'route' => 'zfcuser',
'pages' => array(
array(
'label' => 'Dashboard',
'route' => 'zfcuser',
),
array(
'label' => 'Sign In',
'route' => 'zfcuser/login',
),
array(
'label' => 'Sign Out',
'route' => 'zfcuser/logout',
),
array(
'label' => 'Register',
'route' => 'zfcuser/register',
),
),
),
array(
'label' => 'Platform v2 BETA',
'route' => 'platform',
),
),
),
I display a top-level menu on every page in my layout like so:
<div class="nav-collapse collapse">
<?php echo $this->navigation('navigation')
->menu()
->setMinDepth(0)
->setMaxDepth(0)
->setUlClass('nav')
->render(); ?>
</div>
My navigation appears correctly and has the right section activated for home and the zfcuser routes. It is the platform route which I am having problems with. If I go to /platform
the menu will be activated. However, when I browse to any other page in the module (eg. /platform/pendulum/na/af455e
) there is no active menu and no breadcrumbs. The problem seems to be that the controller/action on these other pages are not the same as the default specified by the route.
How can I get any successful route match to cause the menu to activate?