';
if (isset($attributes['label'])) {
$output .= Form::label($name,$attributes['label'],array('class'=>'control-label'));
unset($attributes['label']);
}
if (isset($attributes['help-block'])) {
$help = $attributes['help-block'];
unset($attributes['help-block']);
}
$output .= '
';
$output .= '%s';
if (isset($help))
$output .= sprintf('%s',$help);
$output .= '
';
$output .= '';
return $output;
}
/**
* Wrap our Form() functions with boostrap HTML
*
* @usedby Form::hidden
* @usedby Form::password
* @usedby Form::file
* @usedby Form::checkbox
* @usedby Form::radio
* @usedby Form::submit
* @usedby Form::image
*/
public static function input($name,$value=NULL,array $attributes=NULL) {
return sprintf(static::_controlgroup($name,$attributes),parent::input($name,$value,$attributes));
}
public static function select($name,array $options=NULL,$selected=NULL,array $attributes=NULL) {
// If only 1 record, dont show select, but a hidden attribute and a displayed value.
if (isset($attributes['oneonly']) AND $attributes['oneonly']) {
$attributes['disabled'] = 'disabled';
unset($attributes['oneonly']);
}
return sprintf(static::_controlgroup($name,$attributes),parent::select($name,$options,$selected,$attributes));
}
public static function textarea($name,$body='',array $attributes=NULL,$double_encode=TRUE) {
if (! isset($attributes['id']))
$attributes['id'] = preg_replace('/[\[\]]/','_',$name);
Script::factory()
->type('stdin')
->data('$("#'.$attributes['id'].'").wysihtml5();');
return sprintf(static::_controlgroup($name,$attributes),parent::textarea($name,$body,$attributes,$double_encode));
}
}
?>