Set default value for label if no value is supplied.

This commit is contained in:
Wesley Hollevoet committed 2013-04-20 12:20:47 +02:00
1 parent a18fa242f1
commit 9587c6ccf9
1 file changed
+5 -1
+5 -1
View File
@@ -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>';
}