Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 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'));
 }
Exemplo n.º 3
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     $this->setRegistry(Registry\Registry::getRegistry());
     $this->setContainer($this->getRegistry()->getContainer($this->_regKey));
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
 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);
 }