I am currently building an application where I have multiple ways to access the same controller.
E.g.:
Presenters -> access controller user/index with param user_type : presenters Attendees -> access controller user/index with param user_type : attendees
In my navigation .ini I have defined both paths (I removed the label, the module and ACL to ease the reading):
dashboard.pages.presenter.controller = "user"
dashboard.pages.presenter.action = "index"
dashboard.pages.presenter.pages.create.controller = "user"
dashboard.pages.presenter.pages.create.action = "create"
dashboard.pages.presenter.pages.edit.controller = "user"
dashboard.pages.presenter.pages.edit.action = "edit"
dashboard.pages.attendee.controller = "user"
dashboard.pages.attendee.action = "index"
dashboard.pages.attendee.pages.create.controller = "user"
dashboard.pages.attendee.pages.create.action = "create"
dashboard.pages.attendee.pages.edit.controller = "user"
dashboard.pages.attendee.pages.edit.action = "edit"
The issue I am having is that when i go to the attendee section, the breadcrumb that is displayed is the one for the presenters. I understand that it work as intended, but I am looking for a way to set the right "node" active based on the URL param user_type
.
Using this :
$page = $this->view->navigation()->findOneByLabel($label);
if ($page) {
$page->setActive();
}
I have been able to set a page to active, but I am looking for a way to "reset" the Zend_Navigation
state to none.
As long as I got you right put this in your Bootstrap and copy the controller plugin I wrote for you. I did not test yet what happens if no navigation was set to the view. Better test that. By the way having equal pages using different routes is not good in terms of seo.
Bootstrap:
Controller Plugin: