Example #1
0
 /**
  * @param \inkvizytor\FluentForm\Base\Field $control
  */
 public function control(Field $control)
 {
     $this->name($control->getName());
     $this->help($control->getHelp());
     $this->label($control->getLabel(), $this->isSrOnly());
     $this->required($control->isRequired());
     $this->setAttr($control->getAttr(null));
     $this->setData($control->getData(null));
     $this->css($control->getCss());
     $width = $control->getWidth();
     $this->width(array_get($width, 'lg'), array_get($width, 'md'), array_get($width, 'sm'), array_get($width, 'xs'));
     $this->control = $control;
 }
Example #2
0
 /**
  * @param \inkvizytor\FluentForm\Base\Handler $handler
  * @param string $type
  */
 public function __construct(Handler $handler, $type = 'checkbox')
 {
     $this->type = $type;
     parent::__construct($handler);
 }
Example #3
0
 /**
  * @param \inkvizytor\FluentForm\Base\Field $control
  * @return bool
  */
 public function isRequired(Field $control)
 {
     $rules = array_get($this->rules, $control->getName(), []);
     return $control->isRequired() || (is_array($rules) ? array_has($rules, 'required') : str_contains($rules, 'required'));
 }
Example #4
0
 /**
  * @param Field $control
  * @return string
  */
 private function renderHelp(Field $control)
 {
     if (!empty($control->getHelp())) {
         return $this->html()->tag('p', ['class' => 'help-block'], $control->getHelp());
     }
     return '';
 }
Example #5
0
 /**
  * @param Field $control
  * @return string
  */
 private function renderHelp(Field $control)
 {
     if (!empty($control->getHelp())) {
         return sprintf('<p class="help-block">%s</p>', $control->getHelp());
     }
     return '';
 }