ZF-10959: Option 'defaultPageType' of the Zend_Application_Resource_Navigation is set after building the pages tree.
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:
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:
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.