Refactoring some code in the form builder.

This commit is contained in:
Taylor Otwell committed 2013-04-30 10:12:42 -05:00
1 parent 028689911f
commit 85e26105f1
1 file changed
+14 -5
+14 -5
View File
@@ -182,12 +182,21 @@ class FormBuilder {
$options = $this->html->attributes($options);
if (is_null($value))
{
$value = ucwords(str_replace('_', ' ', $name));
}
$value = e($this->formatLabel($name, $value));
return '<label for="'.$name.'"'.$options.'>'.e($value).'</label>';
return '<label for="'.$name.'"'.$options.'>'.$value.'</label>';
}
/**
* Format the label value.
*
* @param string $name
* @param string|null $value
* @return string
*/
protected function formatLabel($name, $value)
{
return $value ?: ucwords(str_replace('_', ' ', $name));
}
/**