/** * @return void */ public function testSetContainerCreatesRegistersContainerInstance() { $foo = new Zend_View_Helper_Placeholder_Container(array('foo', 'bar')); $this->assertFalse($this->registry->containerExists('foo')); $this->registry->setContainer('foo', $foo); $container = $this->registry->getContainer('foo'); $this->assertSame($foo, $container); }
/** * Checks whether a placeholder contains data or view variable exists * * @param string $name the name of the placeholder or view variable */ public function has($name) { // check view variables if (isset($this->{$name}) && !empty($this->{$name}) && $this->{$name} != '') { return true; } // check placeholders if ($this->_placeholderRegistry->containerExists($name)) { $value = $this->_placeholderRegistry->getContainer($name)->getValue(); if (is_array($value)) { foreach ($value as $v) { if (!empty($v) && $v != '') { return true; } } } else { if (!empty($value) && $value != '') { return true; } } } return false; }
/** * Placeholder helper * * @param string $name * @return Zend_View_Helper_Placeholder_Container_Abstract */ public function placeholder($name) { $name = (string) $name; return $this->_registry->getContainer($name); }