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
+13 -4
+13 -4
View File
@@ -182,12 +182,21 @@ class FormBuilder {
$options = $this->html->attributes($options); $options = $this->html->attributes($options);
if (is_null($value)) $value = e($this->formatLabel($name, $value));
{
$value = ucwords(str_replace('_', ' ', $name)); return '<label for="'.$name.'"'.$options.'>'.$value.'</label>';
} }
return '<label for="'.$name.'"'.$options.'>'.e($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));
} }
/** /**