From 9587c6ccf9a4d90f670c2972614149a97323df6f Mon Sep 17 00:00:00 2001 From: Wesley Hollevoet Date: Sat, 20 Apr 2013 12:20:47 +0200 Subject: [PATCH] Set default value for label if no value is supplied. --- FormBuilder.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/FormBuilder.php b/FormBuilder.php index c6fb6c3..3dfa472 100644 --- a/FormBuilder.php +++ b/FormBuilder.php @@ -176,12 +176,16 @@ class FormBuilder { * @param array $options * @return string */ - public function label($name, $value, $options = array()) + public function label($name, $value='', $options = array()) { $this->labels[] = $name; $options = $this->html->attributes($options); + if (!$value) { + $value = ucfirst(str_replace('_', ' ', $name)) . ': '; + } + return ''; }