/** * Placeholder helper * * @param string $name * @return \Zend\View\Helper\Placeholder\Container\AbstractContainer */ public function direct($name = null) { if ($name == null) { throw new \InvalidArgumentException('Placeholder: missing argument. $name is required by placeholder($name)'); } $name = (string) $name; return $this->_registry->getContainer($name); }
public function testNamespaceRegisteredInPlaceholderRegistryAfterInstantiation() { $registry = Registry\Registry::getRegistry(); if ($registry->containerExists('Zend_View_Helper_HeadTitle')) { $registry->deleteContainer('Zend_View_Helper_HeadTitle'); } $this->assertFalse($registry->containerExists('Zend_View_Helper_HeadTitle')); $helper = new Helper\HeadTitle(); $this->assertTrue($registry->containerExists('Zend_View_Helper_HeadTitle')); }
/** * Constructor * * @return void */ public function __construct() { $this->setRegistry(Registry\Registry::getRegistry()); $this->setContainer($this->getRegistry()->getContainer($this->_regKey)); }
/** * Initialize placeholder container for layout vars * * @return \Zend\View\Helper\Placeholder\Container\Container */ protected function _initVarContainer() { if (null === $this->_container) { $this->_container = \Zend\View\Helper\Placeholder\Registry\Registry::getRegistry()->getContainer(__CLASS__); } return $this->_container; }
public function testGetRegistryRegistersWithGlobalRegistry() { $this->assertFalse(\Zend\Registry::isRegistered(Registry\Registry::REGISTRY_KEY)); $registry = Registry\Registry::getRegistry(); $this->assertTrue(\Zend\Registry::isRegistered(Registry\Registry::REGISTRY_KEY)); $registered = \Zend\Registry::get(Registry\Registry::REGISTRY_KEY); $this->assertSame($registry, $registered); }