Beispiel #1
0
 public function elementDefaultRender(Element $element)
 {
     if ($element instanceof Element\Drawable) {
         return $element->render($this->getLocalValue(), $this->getLocalValue());
     } else {
         throw new \UForm\Exception("Trying to render an invalid element. Element not implementing Drawable cant be rendered");
     }
 }
Beispiel #2
0
 /**
  * Process to the default render of the given element. The element must implement Drawable
  * @param Element $element
  * @param array $options
  * @return mixed
  * @throws \UForm\Exception
  */
 public function elementDefaultRender(Element $element, $options = [])
 {
     if ($element instanceof Element\Drawable) {
         $navigator = new Navigator();
         $value = $navigator->arrayGet($this->formContext->getData()->getDataCopy(), $element->getName(true, true), 1);
         return $element->render($value, $options);
     } else {
         throw new \UForm\Exception('Trying to render an invalid element. Element not implementing Drawable cant be rendered');
     }
 }