public function testRenderingPartialShouldFailOnInvalidPartialArray() { $this->_helper->setPartial(array('menu.phtml')); try { $this->_helper->render(); $this->fail('invalid $partial should throw Zend\\View\\Exception\\InvalidArgumentException'); } catch (\Zend\View\Exception\ExceptionInterface $e) { } }
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>'; } }
/** * {@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; }