Пример #1
0
 /**
  * Configure the provided service manager instance with the configuration
  * in this class.
  *
  * Simply adds a factory for the navigation helper, and has it inject the helper
  * with the service locator instance.
  *
  * @param  ServiceManager $serviceManager
  * @return void
  */
 public function configureServiceManager(ServiceManager $serviceManager)
 {
     $serviceManager->setFactory('navigation', function (HelperPluginManager $pm) {
         $helper = new \Zend\View\Helper\Navigation();
         $helper->setServiceLocator($pm->getServiceLocator());
         return $helper;
     });
 }
Пример #2
0
 /**
  * Configure the provided service manager instance with the configuration
  * in this class.
  *
  * Simply adds a factory for the navigation helper, and has it inject the helper
  * with the service locator instance.
  *
  * @param  ServiceManager $serviceManager
  * @return void
  */
 public function configureServiceManager(ServiceManager $serviceManager)
 {
     $serviceManager->setFactory('navigation', function (HelperPluginManager $pm) {
         $helper = new \Zend\View\Helper\Navigation();
         $helper->setServiceLocator($pm->getServiceLocator());
         $config = $pm->getServiceLocator()->get('config');
         if (isset($config['navigation_helpers'])) {
             $config = new \Zend\ServiceManager\Config($config['navigation_helpers']);
             $config->configureServiceManager($helper->getPluginManager());
         }
         return $helper;
     });
 }