Example #1
0
 /**
  * Prints out Field wrapped in ControlGroup
  *
  * @return string A form field
  */
 public function __toString()
 {
     // Dry syntax (hidden fields, plain fields)
     if (static::$field->type == 'hidden' or static::form()->type == 'search' or static::form()->type == 'inline') {
         $html = static::$field->__toString();
     } elseif (static::$useBootstrap and static::form()->type) {
         $html = $this->control()->wrapField(static::$field);
     } else {
         $html = \Form::label(static::$field->name, static::$field->label);
         $html .= static::$field;
     }
     // Destroy field instance
     static::$field = null;
     return $html;
 }
Example #2
0
 /**
  * Prints out Field wrapped in ControlGroup
  *
  * @return string A form field
  */
 public function __toString()
 {
     if (static::$form and !static::$form->isOpened()) {
         return static::form()->__toString();
     }
     // Dry syntax (hidden fields, plain fields)
     if (static::$field->isUnwrappable()) {
         $html = static::$field->__toString();
     } elseif (Framework::isnt(null) and static::$form) {
         $html = $this->control()->wrapField(static::$field);
     } else {
         $html = Framework::label(static::$field);
         $html .= static::$field;
     }
     return $html;
 }
Example #3
0
 /**
  * Prints out Field wrapped in ControlGroup
  *
  * @return string A form field
  */
 public function __toString()
 {
     // Dry syntax (hidden fields, plain fields)
     if (static::$field->type == 'hidden' or static::form()->type == 'search' or static::form()->type == 'inline') {
         $html = static::$field->__toString();
     } elseif (Framework::isnt(null) and static::$form) {
         $html = $this->control()->wrapField(static::$field);
     } else {
         // Get label
         $label = static::$field->label;
         $labelText = is_array($label) ? array_get($label, 'label') : $label;
         $labelAttributes = is_array($label) ? array_get($label, 'attributes') : array();
         $html = \Form::label(static::$field->name, $labelText, $labelAttributes);
         $html .= static::$field;
     }
     return $html;
 }