Refactoring some code in the form builder.
This commit is contained in:
1 parent
028689911f
commit
85e26105f1
1 file changed
+14
-5
+14
-5
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user