Exemplo n.º 1
0
 protected function populateElement(Element $element)
 {
     $name = $element->getName();
     if ($name && isset($_POST[$name])) {
         $element->setValue($_POST[$name]);
     }
 }
Exemplo n.º 2
0
 /**
  * @param Element $element
  */
 protected function setErrorMessages(Element $element)
 {
     $arrValidators = $element->getValidators();
     foreach ($arrValidators as $validator) {
         if ($message = $validator->getMsg()) {
             $messageHolder = $this->elementFactory->create('Div');
             $messageDiv = $this->elementFactory->create('Div');
             $messageDiv->addChild(str_replace('{field}', $element->getName(), $message));
             $messageDiv->setAttribute('ng-show', $validator->getAngularJSValidator($element));
             $messageHolder->addChild($messageDiv);
             $element->addSibling($messageHolder);
         }
     }
 }
Exemplo n.º 3
0
 protected function populateElement(Element $element)
 {
     $name = $element->getName();
     if ($name && $this->record->keyExists($name)) {
         if ($element->getAttribute('type') == 'checkbox') {
             $element->setValue(1);
             if ($this->record->{$name}) {
                 $element->setAttribute('checked', 'checked');
             }
         } elseif ($element->getAttribute('type') == 'password') {
             // do nothing
         } else {
             $element->setValue($this->record->{$name});
         }
     }
 }
Exemplo n.º 4
0
 /**
  * @param Element $element
  * @param Element $wrapper
  *
  * @return mixed|object
  */
 protected function addHiddenForCheckbox(Element $element, Element $wrapper)
 {
     $hidden = $this->elementFactory->create("Hidden");
     $hidden->setName($element->getName())->setValue(null);
     $wrapper->addChild($hidden);
     return $hidden;
 }