From 2455af09c54a41a5d10f27040be9b313d6d35872 Mon Sep 17 00:00:00 2001 From: euromark Date: Wed, 25 Sep 2013 14:01:35 +0200 Subject: [PATCH] Resolves ticket #4100 --- .../Test/Case/View/Helper/FormHelperTest.php | 34 +++++++++++++++++++ lib/Cake/View/Helper/FormHelper.php | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index 2ffdfcdbe..97dd8a0ae 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -3978,6 +3978,40 @@ class FormHelperTest extends CakeTestCase { '/div' ); $this->assertTags($result, $expected); + + $result = $this->Form->input('Model.field', array( + 'type' => 'radio', + 'options' => array( + 1 => 'A', + 2 => 'B', + 3 => 'C' + ), + 'disabled' => array(1) + )); + + $expected = array( + 'div' => array('class' => 'input radio'), + 'fieldset' => array(), + 'legend' => array(), + 'Field', + '/legend', + array('input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'id' => 'ModelField_', 'value' => '')), + array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'id' => 'ModelField1', 'disabled' => 'disabled', 'value' => '1')), + array('label' => array('for' => 'ModelField1')), + 'A', + '/label', + array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'id' => 'ModelField2', 'value' => '2')), + array('label' => array('for' => 'ModelField2')), + 'B', + '/label', + array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'id' => 'ModelField3', 'value' => '3')), + array('label' => array('for' => 'ModelField3')), + 'C', + '/label', + '/fieldset', + '/div' + ); + $this->assertTags($result, $expected); } /** diff --git a/lib/Cake/View/Helper/FormHelper.php b/lib/Cake/View/Helper/FormHelper.php index 542655709..377728b8f 100644 --- a/lib/Cake/View/Helper/FormHelper.php +++ b/lib/Cake/View/Helper/FormHelper.php @@ -1506,7 +1506,7 @@ class FormHelper extends AppHelper { } foreach ($options as $optValue => $optTitle) { - $optionsHere = array('value' => $optValue); + $optionsHere = array('value' => $optValue, 'disabled' => false); if (isset($value) && strval($optValue) === strval($value)) { $optionsHere['checked'] = 'checked';