/** * String representation of dojo environment * * @return string */ public function __toString() { if (!$this->isEnabled()) { return ''; } $this->_isXhtml = $this->view->doctype()->isXhtml(); if (Zend_Dojo_View_Helper_Dojo::useDeclarative()) { if (null === $this->getDjConfigOption('parseOnLoad')) { $this->setDjConfigOption('parseOnLoad', true); } } if (!empty($this->_dijits)) { $this->registerDijitLoader(); } $html = $this->_renderStylesheets() . PHP_EOL . $this->_renderDjConfig() . PHP_EOL . $this->_renderDojoScriptTag() . PHP_EOL . $this->_renderLayers() . PHP_EOL . $this->_renderExtras(); return $html; }
/** * Whether or not to use declarative dijit creation * * @return bool */ protected function _useDeclarative() { return Zend_Dojo_View_Helper_Dojo::useDeclarative(); }
public function testShouldAllowSpecifyingDeclarativeUsage() { Zend_Dojo_View_Helper_Dojo::setUseDeclarative(); $this->assertTrue(Zend_Dojo_View_Helper_Dojo::useDeclarative()); }
public function testShouldJsonEncodeConstraints() { $html = $this->getElement(); if (!preg_match('/constraints="(.*?)(" )/', $html, $m)) { $this->fail('Did not serialize constraints'); } $constraints = str_replace("'", '"', $m[1]); if (Zend_Dojo_View_Helper_Dojo::useDeclarative()) { // Convert ' to "'" for json_decode. See Zend_Dojo_View_Helper_Dijit::_prepareDijit() (line 254) $constraints = str_replace(''', '"', $constraints); } $constraints = Zend_Json::decode($constraints); $this->assertTrue(is_array($constraints), var_export($m[1], 1)); $this->assertTrue(array_key_exists('min', $constraints)); $this->assertTrue(array_key_exists('max', $constraints)); $this->assertTrue(array_key_exists('places', $constraints)); }
public function testShouldUseDeclarativeDijitCreationByDefault() { $this->assertTrue(Zend_Dojo_View_Helper_Dojo::useDeclarative()); }