I'm officially confused.
Is it possible to have two views which work together but are separate?
In desperation, I went back to how I was doing it before, in the bootstrap,
and then traced it again. The pluginloader found the bootstrap version and
then, as described, appended it with the Zend_View_Helper_Navigation prefix
ensuring it was loaded in preference to my own.
So, thinking along the lines described earlier, I defined the zend path
before my own (in bootstrap). And now it works.
But I'd love to understand why. If I add breakpoints on where the
helperPaths are set, I can watch two distinct objects have paths set, one
from application.ini settings, and the other from the settings in the
bootstrap.
I'm wondering if it is something to do with using a layout, or more the way
I am attaching things to my view in my bootstrap. (just out of interest,
the navigation object is part of my layout).
//Bootstrap.php
protected function _initSettings()
{
// Retrieve the view
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
// Register Custom URL Handler
$urlHelper = new Custom_Controller_Action_Helper_Url();
Zend_Controller_Action_HelperBroker::addHelper($urlHelper);
// Create ACL and add the ACL action helper
$acl = new Custom_Acl();
$aclHelper = new Custom_Controller_Action_Helper_Acl(null,
array('acl' => $acl));
Zend_Controller_Action_HelperBroker::addHelper($aclHelper);
// Create the site navigation object
$nav_config = new Zend_Config_Xml(APPLICATION_PATH .
'/configs/navigation.xml', 'nav');
$nav_config = $this->_extrapolateAcl($nav_config->toArray());
$navigation = new Zend_Navigation($nav_config);
$role = Zend_Auth::getInstance()->getIdentity();
if(null == $role)
$role = 'guest';
else
$role = $role->role;
// Attach navigation to the view
$view->navigation($navigation)->setAcl($acl)->setRole($role);
// Other view configuration
$view->addHelperPath('Zend/View/Helper/Navigation',
'Zend_View_Helper_Navigation');
$view->addHelperPath('Custom/View/Helper', 'Custom_View_Helper');
$view->doctype('HTML5');
}
I'm feeling like I'm creating a layout view here, distinct from the main
view, and the two carry their own configurations until the final stages of
the render process.
Is this normal or am I just doing it wrong?
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/How-can-I-extend-Zend-View-Helper-Navigation-Menu-tp3383587p3384096.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]