Bootstrapper\Form::validation PHP Method

validation() public method

Creates a validation block
public validation ( string $type, string $label, string $input, array $attributes = [] ) : string
$type string The type of validation
$label string The label
$input string The input
$attributes array The attributes of the validation block
return string
    public function validation($type, $label, $input, $attributes = [])
    {
        $attributes['class'] = isset($attributes['class']) ? "form-group {$type} " . $attributes['class'] : "form-group {$type} ";
        $attributes = new Attributes($attributes);
        return "<div {$attributes}>{$label}{$input}</div>";
    }

Usage Example

Example #1
0
 /**
  * Creates a validation block
  *
  * @param string $type The type of validation
  * @param string $label The label
  * @param string $input The input
  * @param array $attributes The attributes of the validation block
  * @return string 
  * @static 
  */
 public static function validation($type, $label, $input, $attributes = array())
 {
     return \Bootstrapper\Form::validation($type, $label, $input, $attributes);
 }