Esempio n. 1
0
 public function testRenderDeepestMenuWithPageClassToLi()
 {
     $options = array('addClassToListItem' => true, 'onlyActiveBranch' => true, 'renderParents' => false);
     $pages = $this->_nav2->toArray();
     $pages[1]['class'] = 'foobar';
     $container = new \Zend\Navigation\Navigation($pages);
     $expected = $this->_getExpected('menu/onlyactivebranch_addclasstolistitem.html');
     $actual = $this->_helper->renderMenu($container, $options);
     $this->assertEquals(trim($expected), trim($actual));
 }
Esempio n. 2
0
 public function render($container = null)
 {
     $container = $container ? $container : $this->getContainer();
     try {
         $output = parent::render($container);
         return $output;
     } catch (Exception $e) {
         return '<div class="alert-danger alert"><span class="fa fa-exclamation-triangle"></span> ' . $e->getMessage() . '</div>';
     }
 }
 public function __invoke($oContainer = null)
 {
     parent::__invoke($oContainer);
     if ($this->serviceLocator->getServiceLocator()->get('ControllerPluginManager')->has('AclPlugin')) {
         $oAclPlugin = $this->serviceLocator->getServiceLocator()->get('ControllerPluginManager')->get('AclPlugin');
         if (isset($oAclPlugin)) {
             $this->setAcl($oAclPlugin->getAcl());
             $this->setRole($oAclPlugin->getRole());
         }
     }
     return $this;
 }
 public function __invoke($ontainer, $attr = array())
 {
     $this->attr = $attr;
     return parent::__invoke($ontainer);
 }
Esempio n. 5
0
 /**
  * {@inheritDoc}
  */
 public function render($container = null)
 {
     Pi::service('log')->start('menu');
     // Try to load from cache
     if ($this->cache) {
         $cacheKey = $this->cache->key . '-mu';
         $content = $this->cache->storage->getItem($cacheKey);
         if (null !== $content) {
             if (Pi::service()->hasService('log')) {
                 Pi::service('log')->info('Menu is loaded from cache.');
             }
             return $content;
         }
     }
     // Generate if no cache available
     $content = parent::render($container);
     // Save to cache
     if ($this->cache) {
         $this->cache->storage->setItem($cacheKey, $content);
     }
     Pi::service('log')->end('menu');
     return $content;
 }
 public function __invoke($container = null, $attribute = array())
 {
     $this->ulAttribute = $attribute;
     return parent::__invoke($container);
 }
Esempio n. 7
0
 /**
  * {@inheritDoc}
  */
 public function __toString()
 {
     try {
         $markup = parent::__toString();
     } catch (\Exception $e) {
         $markup = $e->getMessage();
     }
     return $markup;
 }