Beispiel #1
0
 /**
  * Converts the label to html code.
  *
  * @param string $prepend Optional string prepended to html content
  * @param string $append  Optional string appended to html content
  *
  * @return string
  */
 public function toHtml($prepend = '', $append = '')
 {
     //Do not print empty labels
     if (strlen($this->html . $prepend . $append) === 0) {
         return '';
     }
     $this->attr('for', $this->input->id());
     return parent::toHtml($prepend, $append);
 }
 /**
  * Generates the html code of a checkbox/radio field
  *
  * @param Field $field
  *
  * @return string
  */
 private static function getRadioCheckHtml($field)
 {
     //Errors
     if ($field->error()) {
         $field->errorLabel->addClass('text-danger');
     }
     $html = $field->input->toHtml();
     $html = $field->label->toHtml($html . ' ') . $field->errorLabel;
     $html = Element::div(true)->class($field->input->attr('type'))->toHtml($html);
     //Help block
     if ($help = $field->get('help')) {
         $html .= Element::span(true)->class('help-block')->toHtml($help);
     }
     return $html;
 }