Set default value for label if no value is supplied.
This commit is contained in:
1 parent
a18fa242f1
commit
9587c6ccf9
1 file changed
+5
-1
+5
-1
@@ -176,12 +176,16 @@ class FormBuilder {
|
||||
* @param array $options
|
||||
* @return string
|
||||
*/
|
||||
public function label($name, $value, $options = array())
|
||||
public function label($name, $value='', $options = array())
|
||||
{
|
||||
$this->labels[] = $name;
|
||||
|
||||
$options = $this->html->attributes($options);
|
||||
|
||||
if (!$value) {
|
||||
$value = ucfirst(str_replace('_', ' ', $name)) . ': ';
|
||||
}
|
||||
|
||||
return '<label for="'.$name.'"'.$options.'>'.e($value).'</label>';
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user