示例#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;
 }
示例#2
0
 /**
  * @param Field $control
  * @return string
  */
 private function renderErrors(Field $control)
 {
     foreach ($this->getErrorMessages($control->getName()) as $message) {
         $name = str_replace('_', ' ', Str::snake($control->getName()));
         $label = $control->getLabel() ? $control->getLabel() : $control->getPlaceholder();
         $message = str_replace($name, $label, $message);
         // Return only first error
         return $this->html()->tag('label', ['for' => $control->getName(), 'class' => 'error'], $message);
     }
     return '';
 }
示例#3
0
 /**
  * @param Field $control
  * @return string
  */
 private function renderErrors(Field $control)
 {
     foreach ($this->getErrorMessages($control->getName()) as $message) {
         $name = str_replace('_', ' ', Str::snake($control->getName()));
         $label = $control->getLabel() ? $control->getLabel() : $control->getPlaceholder();
         $message = str_replace($name, $label, $message);
         // Return only first error
         return sprintf('<label class="error" for="%s">%s</label>', $control->getName(), $message);
     }
     return '';
 }