Exemple #1
0
 /**
  * @param InputElement|Select|ToggleGroup $element
  *
  * @since 2.0
  */
 public function renderInput($element)
 {
     if ($element instanceof Option || $element instanceof Optgroup || $element instanceof Checkbox || $element instanceof Radio) {
         return $element->render($this);
     }
     $name = $element->getName();
     $element->setAttribute('id', 'form_' . $name);
     $this->table->addCell($element->getLabel());
     $this->table->addCell($element->render($this));
     $this->table->addRow();
     return '';
 }
Exemple #2
0
 /**
  * @param InputElement|Select|ToggleGroup $element
  *
  * @return string
  *
  * @since 2.0
  */
 public function renderInput($element)
 {
     if ($element instanceof Fieldset || $element instanceof Option || $element instanceof Optgroup || $element instanceof Radio) {
         return $element->render($this);
     }
     $element->setAttribute('class', trim($element->getAttribute('class') . ' form-control'));
     $name = $element->getName();
     $element->setAttribute('id', 'form_' . $name);
     $elementHtml = $element->render($this);
     $renderGroup = $element->getMeta('group', true);
     $content = '';
     if ($renderGroup) {
         $content = '<div class="form-group">';
     }
     if (trim($element->getLabel()) != '') {
         $content .= '<label for="' . $element->getAttribute('id') . '">' . $element->getLabel() . '</label>';
     }
     $content .= $elementHtml;
     if ($renderGroup) {
         $content .= '</div>';
     }
     return $content;
 }