From a3abe59bdc2eea14cbfa0b5c93e13a13329a0340 Mon Sep 17 00:00:00 2001 From: Wouter van Dongen Date: Tue, 7 Jan 2014 18:34:46 +0100 Subject: [PATCH 1/2] Set label text without having to create array 'text' key. --- View/Helper/BoostCakeFormHelper.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/View/Helper/BoostCakeFormHelper.php b/View/Helper/BoostCakeFormHelper.php index 73583a3..32fbc5c 100644 --- a/View/Helper/BoostCakeFormHelper.php +++ b/View/Helper/BoostCakeFormHelper.php @@ -76,6 +76,12 @@ public function input($fieldName, $options = array()) { 'afterInput' => '', 'errorClass' => 'has-error error' ); + + if (isset($options['label']) && is_string($options['label'])) { + $options['label'] = array( + 'text' => $options['label'] + ); + } $options = Hash::merge( $default, From 27135bf1e0a05970f5ece278a0dd8809f09f3c8d Mon Sep 17 00:00:00 2001 From: Wouter van Dongen Date: Wed, 8 Jan 2014 17:51:15 +0100 Subject: [PATCH 2/2] Fix test case for CakePHP 2.4.4. --- Test/Case/View/Helper/BoostCakeFormHelperTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Test/Case/View/Helper/BoostCakeFormHelperTest.php b/Test/Case/View/Helper/BoostCakeFormHelperTest.php index 424c58c..bf6f757 100644 --- a/Test/Case/View/Helper/BoostCakeFormHelperTest.php +++ b/Test/Case/View/Helper/BoostCakeFormHelperTest.php @@ -306,12 +306,12 @@ public function testRadio() { 'Name', '/legend', array('input' => array('type' => 'hidden', 'name' => 'data[name]', 'id' => 'name_', 'value' => '')), - array('label' => array('for' => 'NameOne', 'class' => 'radio')), - array('input' => array('name' => 'data[name]', 'type' => 'radio', 'value' => 'one', 'id' => 'NameOne')), + array('label' => array('for' => 'nameOne', 'class' => 'radio')), + array('input' => array('name' => 'data[name]', 'type' => 'radio', 'value' => 'one', 'id' => 'nameOne')), ' This is one', '/label', - array('label' => array('for' => 'NameTwo', 'class' => 'radio')), - array('input' => array('name' => 'data[name]', 'type' => 'radio', 'value' => 'two', 'id' => 'NameTwo')), + array('label' => array('for' => 'nameTwo', 'class' => 'radio')), + array('input' => array('name' => 'data[name]', 'type' => 'radio', 'value' => 'two', 'id' => 'nameTwo')), ' This is two', '/label', '/fieldset',