0

I have a presistent requirement which causes me problems when using Zend Navigation. A simplified example would be a system which has a database entity like "albums", for which the user needs a "list", "add", "edit" and "delete" page. The "list" and "add" pages are included in the menu system, but the "edit" and "delete" pages, being specific to an particular "album" are linked to from the "list" page.

The issue is that navigating to an "edit" or "delete" page causes the "albums" menu branch to go inactive. Obviously this is because those pages are not in the navigation hierarchy.

I'm looking for:

  1. A good way to put these pages in the navigation hierarchy, but not display them.
  2. A way to define the currently active branch from within the controller, so that I can keep the appropriate branch of the menu active.
  3. A method I have not thought of which accomplishes this.

Thanks

NaNuk
  • 141
  • 9

1 Answers1

1

OK One possible solution found since posting the question going down route 1 from the above potential approaches.

When creating the menu container use the 'visible'property e.g

    array(
      'label'      => 'Edit Vehicle',
      'action'     => 'update',
      'controller' => 'vehicle',
      'route'      => 'update-vehicle',
      'visible'    => false
    ),
    ...

for each page that should be in the menu for the purposes of generating appropriate "is active" behaviour but is not appropriate to be displayed.

Then in the partial generating the menu test

$page->isVisible 

and react accordingly. But is this the prescribed method?

NaNuk
  • 141
  • 9