/** * Set the view object * * Ensures that the view object has the dojo view helper path set. * * @param \Zend\View\ViewEngine $view * @return \Zend\Dojo\Form\Element\Dijit */ public function setView(View $view = null) { if (null !== $view) { if (false === $view->getPluginLoader('helper')->getPaths('Zend\\Dojo\\View\\Helper')) { $view->addHelperPath('Zend/Dojo/View/Helper', 'Zend\\Dojo\\View\\Helper'); } } return parent::setView($view); }
public function testRetrievingLabelRetrievesLabelWithTranslationAndPrefixAndSuffix() { $translate = new Translator('ArrayAdapter', array('My Label' => 'Translation'), 'en'); $translate->setLocale('en'); $element = new Element('foo'); $element->setView($this->getView()) ->setLabel('My Label') ->setTranslator($translate); $this->decorator->setElement($element) ->setOptions(array( 'optionalPrefix' => '> ', 'optionalSuffix' => ':', 'requiredPrefix' => '! ', 'requiredSuffix' => '*:', )); $label = $this->decorator->getLabel(); $this->assertEquals('> Translation:', $label); $element->setRequired(true); $label = $this->decorator->getLabel(); $this->assertEquals('! Translation*:', $label); }
/** * Set the view object * * Ensures that the view object has the dojo view helper path set. * * @param \Zend\View\Renderer $view * @return \Zend\Dojo\Form\Element\Dijit */ public function setView(View $view = null) { if (null !== $view) { if (false === $view->broker()->isLoaded('dojo')) { $loader = new \Zend\Dojo\View\HelperLoader(); $view->broker()->getClassLoader()->registerPlugins($loader); } } return parent::setView($view); }