Issues

ZF-10959: Option 'defaultPageType' of the Zend_Application_Resource_Navigation is set after building the pages tree.

Issue Type: Bug Created: 2011-01-17T12:27:44.000+0000 Last Updated: 2011-06-04T01:51:46.000+0000 Status: Resolved Fix version(s): - 1.11.8 (07/Jul/11)

Reporter: Jakub Igla (qba_rox) Assignee: Dolf Schimmel (Freeaqingme) (freak) Tags: - Zend_Application_Resource

Related issues: Attachments:

Description

I'm using Zend_Application and I had to extend Zend_Navigation_Page so I've created my custom class Qengine_Navigation_Page and then in configuration file of my application I've set 'defaultPageType' to 'Qengine_Navigation_Page'. I was very confused, why all page in the main container are instances of Zend_Navigation_Page, not of mine custom class. So I've done my homework and found out, that this code 'Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']);' should be invoked before building the tree from 'pages' options in configuration file, so the type of the Page can be changed.

That's how it should be done:

<pre class="highlight">
public function init()
    {
        if (!$this->_container) {
            $options = $this->getOptions();
            
            if(isset($options['defaultPageType'])) {
                Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']);                
            }
            
            $pages = isset($options['pages']) ? $options['pages'] : array();
            $this->_container = new Zend_Navigation($pages);
        }

        $this->store();
        return $this->_container;
    }

Comments

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2011-01-17T12:35:25.000+0000

This is what it should be:

<pre class="highlight">    public function init()
    {
        if (!$this->_container) {
            $options = $this->getOptions();

            if(isset($options['defaultPageType'])) {
                Zend_Navigation_Page::setDefaultPageType($options['defaultPageType']);
            }

            $pages = isset($options['pages']) ? $options['pages'] : array();
            $this->_container = new Zend_Navigation($pages);

        }

        $this->store();
        return $this->_container;
    }

The reason I hadn't documented it because I wanted to fix this one first - but totally forgot (as you can tell). Will fix asap.

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2011-06-04T01:51:28.000+0000

Resolved in r24113. Merged into release 1.11 branch in r24114.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts