zend-framework2zend-viewzend-navigation

Multi navigation failed in layout


why second var_dump() display null in this code in my layout.phtml :

var_dump(($this->navigation('navigation')->menu()->render()));

var_dump(($this->navigation('navigation')->breadcrumbs()->render()));

output :

    string '<ul class="navigation">
    <li>
        <a href="/en/admin">DashBoard</a>
    </li>
    <li>
        <a href="/en/admin/members">Members Management</a>
    </li>
    <li class="active">
        <a href="/en/admin/events">Events</a>
        <ul>
            <li>
                <a href="/en/admin/events/categories">Categories</a>
            </li>
            <li class="active">
                <a href="/en/admin/events">Show All</a>
            </li>
            <li class="active">
                <a href='... (length=802)

string '' (length=0)

EDIT :

actually changing var_dump order ... OMG ... again the second one is NULL !! :-O Output :

string '<a href="/en/admin/events">Events</a> &gt; Show All' (length=51)

string '' (length=0)

Solution

  • There was a bug in zf2 ver <= 2.1.3 about this and its closed but not yet merged into production package and will be fixed in next minor release https://github.com/zendframework/zf2/issues/3976 Simple solution : https://github.com/froschdesign/zf2/commit/454439d35716ed2125a6ac90c826836f57391eb0