From 85e26105f12b943cb0db5faa6c7772634bad0e09 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 30 Apr 2013 10:12:42 -0500 Subject: [PATCH] Refactoring some code in the form builder. --- FormBuilder.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) 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)); } /**