ZF-10641: Zend_View_Helper_Navigation_Menu::renderPartial() don't works with ACL
Description
Hi all, I've tried ACL working with Zend_Navigation using view partials. This is done using the navigation menu view helper and invoking the "setPartial()" method, passing my partial view path in.
The problem is that when you tell it to use a partial, it skips the default rendering method (renderMenu()), which happens to also contain the logic for filtering out menu items based on ACL.
I've temporarily fixed this by inserting a few lines into class Zend_View_Helper_Navigation_Menu, starting at row 596:
596
597 $iterator = new RecursiveIteratorIterator(clone $container, RecursiveIteratorIterator::SELF_FIRST);
598 foreach ($iterator as $page) {
599 /* @var $page Zend_Navigation_Page_Mvc */
600 if (!$this->accept($page)) {
601 $container->removePage($page);
602 }
603 }
604
605 $model = array(
606 'container' => $container
607 );
608
But this works only for items with depth=0...
I hope this helps to find a solution... Regards, Fabio.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2010-11-08T11:50:03.000+0000
Can you provide a reproduce case (preferably as a unit test), please? It should provide: * Minimal code necessary to reproduce the issue * Expected results * Actual results
We need this in order to better evaluate and diagnose the issue.
Posted by Fabio Baleani (fbale) on 2010-11-08T22:10:06.000+0000
This is the code:
CONTROLLER:
VIEW: index.phtml
_partial.phtml
Posted by Fabio Baleani (fbale) on 2010-11-08T22:12:04.000+0000
Expected results:
the first child first one child first two
the third
the first child first one child first two the third
Actual results:
the first child first one child first two
the third
the first child first one child first two the second child one child two the third another child another child
Posted by Kai Uwe (kaiuwe) on 2011-02-14T00:01:51.000+0000
Posted by Kai Uwe (kaiuwe) on 2011-02-14T00:13:44.000+0000
My suggestion:
Posted by Kai Uwe (kaiuwe) on 2011-03-24T09:08:36.000+0000
Another idea:
Posted by Frank Brückner (frosch) on 2011-09-08T08:02:54.000+0000
{quote}But this works only for items with depth=0...{quote} It's very ugly. I'm looking for a solution.
Posted by Frank Brückner (frosch) on 2011-10-11T21:48:23.000+0000
I have found a solution and I will write some unit tests.