Esempio n. 1
0
 public function render()
 {
     if ($this->getGridSize()) {
         /** @var HtmlElement $legend */
         $legend = $this->elements[0];
         if ($legend->getTag() == '<fieldset>') {
             $legend->addClass('col-sm-' . (12 - $this->getGridSize()) . ' col-sm-offset-' . $this->getGridSize());
         }
     }
     return parent::render();
 }
Esempio n. 2
0
 /**
  * @param AbstractField|Group|Fieldset $element
  * @param mixed $userInput
  *
  * @return array
  */
 private function validateValue($element, $userInput) : array
 {
     $valid = true;
     $value = null;
     $typedValue = null;
     if ($element->isRequired() && is_null($userInput)) {
         $valid = false;
     }
     if ($element->getPrimitiveType() && !is_null($userInput)) {
         $typedValue = $this->validateType($userInput, $element->getPrimitiveType());
         if (is_null($typedValue)) {
             $valid = false;
         } else {
             $value = $typedValue;
         }
     } else {
         $value = $userInput;
     }
     if (method_exists($element, 'isValid') && $valid == true && $element->getValue()) {
         $valid = $element->isValid();
     }
     if (!$valid) {
         $value = null;
     }
     return [$valid, $value, $typedValue];
 }