Browse Source

Fixed missing quotes in doc block
Removed spare line
Combined conditions

lilHermit 9 years ago
parent
commit
03ebb2bae0

+ 2 - 2
src/View/Helper/FormHelper.php

@@ -1473,7 +1473,7 @@ class FormHelper extends Helper
      *
      * - `value` - Indicates the value when this radio button is checked.
      * - `label` - Either `false` to disable label around the widget or an array of attributes for
-     *    the label tag. `selected` will be added to any classes e.g. `class => 'myclass'` where widget
+     *    the label tag. `selected` will be added to any classes e.g. `'class' => 'myclass'` where widget
      *    is checked
      * - `hiddenField` - boolean to indicate if you want the results of radio() to include
      *    a hidden input with a value of ''. This is useful for creating radio sets that are non-continuous.
@@ -1984,7 +1984,7 @@ class FormHelper extends Helper
      * - `hiddenField` - Set to false to remove the hidden field that ensures a value
      *   is always submitted.
      * - `label` - Either `false` to disable label around the widget or an array of attributes for
-     *   the label tag. `selected` will be added to any classes e.g. `class => 'myclass'` where
+     *   the label tag. `selected` will be added to any classes e.g. `'class' => 'myclass'` where
      *   widget is checked
      *
      * Can be used in place of a select box with the multiple attribute.

+ 2 - 4
src/View/Widget/RadioWidget.php

@@ -174,10 +174,8 @@ class RadioWidget implements WidgetInterface
             $radio['checked'] = true;
         }
 
-        if (!is_bool($data['label'])) {
-            if (isset($radio['checked']) && $radio['checked']) {
-                $data['label'] = $this->_templates->addClass($data['label'], 'selected');
-            }
+        if (!is_bool($data['label']) && isset($radio['checked']) && $radio['checked']) {
+            $data['label'] = $this->_templates->addClass($data['label'], 'selected');
         }
 
         if ($this->_isDisabled($radio, $data['disabled'])) {

+ 0 - 1
tests/TestCase/View/Helper/FormHelperTest.php

@@ -8727,7 +8727,6 @@ class FormHelperTest extends TestCase
             ],
             'labelOptions' => ['class' => ['custom-class', 'another-class'], 'data-name' => 'bob'],
             'value' => ['1']
-
         ]);
         $expected = [
             ['div' => ['class' => 'input select']],