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