Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
 /**
  * Retrieve view object
  *
  * @return \Zend\View\View
  */
 public function getView()
 {
     if (null === $this->_view) {
         $options = $this->getOptions();
         $this->_view = new \Zend\View\PhpRenderer($options);
         if (isset($options['doctype'])) {
             $this->_view->broker('doctype')->setDoctype(strtoupper($options['doctype']));
         }
     }
     return $this->_view;
 }
Ejemplo n.º 3
0
 /**
  * Dojo-enable a view instance
  *
  * @param  \Zend\View\Renderer $view
  * @return void
  */
 public static function enableView(Renderer $view)
 {
     if (!$view instanceof PhpRenderer) {
         return;
     }
     $view->broker()->getClassLoader()->registerPlugins(new View\HelperLoader());
 }
Ejemplo n.º 4
0
 /**
  * String representation of dojo environment
  *
  * @return string
  */
 public function __toString()
 {
     if (!$this->isEnabled()) {
         return '';
     }
     $this->_isXhtml = $this->view->broker('doctype')->isXhtml();
     if (DojoHelper::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;
 }
Ejemplo n.º 5
0
 /**
  * Recurse through a form object, rendering errors
  *
  * @param  \Zend\Form\Form $form
  * @param  \Zend\View\Renderer $view
  * @return string
  */
 protected function _recurseForm(Form\Form $form, View $view)
 {
     $content = '';
     $custom = $form->getCustomMessages();
     if ($this->getShowCustomFormErrors() && count($custom)) {
         $content .= $this->getMarkupListItemStart() . $view->broker('formErrors')->direct($custom, $this->getOptions()) . $this->getMarkupListItemEnd();
     }
     foreach ($form->getElementsAndSubFormsOrdered() as $subitem) {
         if ($subitem instanceof Form\Element && !$this->getOnlyCustomFormErrors()) {
             $messages = $subitem->getMessages();
             if (count($messages)) {
                 $subitem->setView($view);
                 $content .= $this->getMarkupListItemStart() . $this->renderLabel($subitem, $view) . $view->broker('formErrors')->direct($messages, $this->getOptions()) . $this->getMarkupListItemEnd();
             }
         } elseif ($subitem instanceof Form\Form && !$this->ignoreSubForms()) {
             $content .= $this->getMarkupListStart() . $this->_recurseForm($subitem, $view) . $this->getMarkupListEnd();
         }
     }
     return $content;
 }