Merge pull request #1022 from wesleyh/master

Proposal: Default value for labels.
This commit is contained in:
Taylor Otwell committed 2013-04-30 08:09:18 -07:00
commit 028689911f
1 file changed
+6 -1
+6 -1
View File
@@ -176,12 +176,17 @@ class FormBuilder {
* @param array $options * @param array $options
* @return string * @return string
*/ */
public function label($name, $value, $options = array()) public function label($name, $value = null, $options = array())
{ {
$this->labels[] = $name; $this->labels[] = $name;
$options = $this->html->attributes($options); $options = $this->html->attributes($options);
if (is_null($value))
{
$value = ucwords(str_replace('_', ' ', $name));
}
return '<label for="'.$name.'"'.$options.'>'.e($value).'</label>'; return '<label for="'.$name.'"'.$options.'>'.e($value).'</label>';
} }