diff --git a/FormBuilder.php b/FormBuilder.php index 59e2b7d..61182a1 100644 --- a/FormBuilder.php +++ b/FormBuilder.php @@ -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 ''; + return ''; + } + + /** + * Format the label value. + * + * @param string $name + * @param string|null $value + * @return string + */ + protected function formatLabel($name, $value) + { + return $value ?: ucwords(str_replace('_', ' ', $name)); } /**