protected function _initNavigation() { $this->bootstrap('frontController'); $pages = array(array('label' => 'Home', 'id' => 'index', 'action' => 'index', 'controller' => 'index'), array('label' => 'Entries', 'id' => 'entry', 'action' => 'index', 'controller' => 'entry', 'pages' => array(array('label' => 'New', 'id' => 'entry-new', 'action' => 'new', 'controller' => 'entry'), array('action' => 'get', 'controller' => 'entry', 'visible' => false), array('action' => 'edit', 'controller' => 'entry', 'visible' => false), array('action' => 'post', 'controller' => 'entry', 'visible' => false), array('action' => 'put', 'controller' => 'entry', 'visible' => false), array('action' => 'delete', 'controller' => 'entry', 'visible' => false)))); $resource = new Zend_Application_Resource_Navigation(array('pages' => $pages)); $resource->setBootstrap($this); return $resource->init(); }
protected function _initNavigation() { $this->bootstrap('view'); $this->bootstrap('frontController'); $this->bootstrap('acl'); $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav'); $resource = new Zend_Application_Resource_Navigation(array('pages' => $config->toArray())); $resource->setBootstrap($this); return $resource->init(); }
public function init() { $options = $this->getOptions(); switch ($options['type']) { case 'xml': // FIX FOR IIS CACHE FOLDER START //$config = new Zend_Config_Xml($options['file'], 'nav'); $xml = file_get_contents($options['file']); $config = new Zend_Config_Xml($xml, 'nav'); $this->_container = new Zend_Navigation($config); break; } parent::init(); }
/** * Initialize navigation. * * @return Zend_Navigation */ public function init() { $options = $this->getOptions(); if (isset($options['configFile'])) { if (!$this->_container) { $config = $this->_loadConfig($options['configFile']); $this->_container = new Zend_Navigation($config); } $this->store(); return $this->_container; } else { return parent::init(); } }
/** * @group ZF-7461 */ public function testRegistryIsUsedWhenNumericRegistryValueIsGiven() { // Register view for cases where registry should/is not (be) used $this->bootstrap->registerPluginResource('view'); $this->bootstrap->getPluginResource('view')->getView(); $options1 = array('pages' => array(new Zend_Navigation_Page_Mvc(array('action' => 'index', 'controller' => 'index'))), 'storage' => array('registry' => true)); $options = array($options1, array_merge($options1, array('storage' => array('registry' => '1'))), array_merge($options1, array('storage' => array('registry' => 1))), array_merge($options1, array('storage' => array('registry' => false)))); $results = array(); $key = Zend_Application_Resource_Navigation::DEFAULT_REGISTRY_KEY; foreach ($options as $option) { $resource = new Zend_Application_Resource_Navigation($option); $resource->setBootstrap($this->bootstrap)->init(); $results[] = Zend_Registry::get($key) instanceof Zend_Navigation; Zend_Registry::set($key, null); } $this->assertEquals(array(true, true, true, false), $results); $this->bootstrap->unregisterPluginResource('view'); }