Browse Source

Renamed `optionsLabel` to `labelOptions`

lilHermit 9 years ago
parent
commit
2606865913
2 changed files with 14 additions and 14 deletions
  1. 6 6
      src/View/Helper/FormHelper.php
  2. 8 8
      tests/TestCase/View/Helper/FormHelperTest.php

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

@@ -1009,7 +1009,7 @@ class FormHelper extends Helper
             'options' => null,
             'templates' => [],
             'templateVars' => [],
-            'optionsLabel' => true
+            'labelOptions' => true
         ];
         $options = $this->_parseOptions($fieldName, $options);
         $options += ['id' => $this->_domId($fieldName)];
@@ -1039,8 +1039,8 @@ class FormHelper extends Helper
         $label = $options['label'];
         unset($options['label']);
 
-        $optionsLabel = $options['optionsLabel'];
-        unset($options['optionsLabel']);
+        $labelOptions = $options['labelOptions'];
+        unset($options['labelOptions']);
 
         $nestedInput = false;
         if ($options['type'] === 'checkbox') {
@@ -1053,7 +1053,7 @@ class FormHelper extends Helper
             $options['hiddenField'] = '_split';
         }
 
-        $input = $this->_getInput($fieldName, $options + ['label' => $optionsLabel]);
+        $input = $this->_getInput($fieldName, $options + ['labelOptions' => $labelOptions]);
         if ($options['type'] === 'hidden' || $options['type'] === 'submit') {
             if ($newTemplates) {
                 $templater->pop();
@@ -1134,8 +1134,8 @@ class FormHelper extends Helper
      */
     protected function _getInput($fieldName, $options)
     {
-        $label = $options['label'];
-        unset($options['label']);
+        $label = $options['labelOptions'];
+        unset($options['labelOptions']);
         switch (strtolower($options['type'])) {
             case 'select':
                 $opts = $options['options'];

+ 8 - 8
tests/TestCase/View/Helper/FormHelperTest.php

@@ -8498,7 +8498,7 @@ class FormHelperTest extends TestCase
     }
 
     /**
-     * Tests to make sure `optionsLabel` is rendered correctly by MultiCheckboxWidget and RadioWidget
+     * Tests to make sure `labelOptions` is rendered correctly by MultiCheckboxWidget and RadioWidget
      *
      * Tests false, class (as string and array) also makes sure 'selected' is added to the class if checked.
      * Also checks to make sure any custom attributes are rendered
@@ -8509,7 +8509,7 @@ class FormHelperTest extends TestCase
         $result = $this->Form->input('test', [
             'type' => 'radio',
             'options' => ['A', 'B'],
-            'optionsLabel' => false
+            'labelOptions' => false
         ]);
         $expected = [
             ['div' => ['class' => 'input radio']],
@@ -8527,7 +8527,7 @@ class FormHelperTest extends TestCase
         $result = $this->Form->input('test', [
             'type' => 'radio',
             'options' => ['A', 'B'],
-            'optionsLabel' => ['class' => 'custom-class']
+            'labelOptions' => ['class' => 'custom-class']
         ]);
         $expected = [
             ['div' => ['class' => 'input radio']],
@@ -8552,7 +8552,7 @@ class FormHelperTest extends TestCase
             'type' => 'radio',
             'options' => ['A', 'B'],
             'value' => 1,
-            'optionsLabel' => ['class' => 'custom-class']
+            'labelOptions' => ['class' => 'custom-class']
         ]);
         $expected = [
             ['div' => ['class' => 'input radio']],
@@ -8577,7 +8577,7 @@ class FormHelperTest extends TestCase
             'type' => 'radio',
             'options' => ['A', 'B'],
             'value' => 1,
-            'optionsLabel' => ['class' => ['custom-class', 'custom-class-array']]
+            'labelOptions' => ['class' => ['custom-class', 'custom-class-array']]
         ]);
         $expected = [
             ['div' => ['class' => 'input radio']],
@@ -8633,7 +8633,7 @@ class FormHelperTest extends TestCase
                 ['text' => 'First Checkbox', 'value' => 1],
                 ['text' => 'Second Checkbox', 'value' => 2]
             ],
-            'optionsLabel' => false
+            'labelOptions' => false
         ]);
         $expected = [
             ['div' => ['class' => 'input select']],
@@ -8660,7 +8660,7 @@ class FormHelperTest extends TestCase
                 ['text' => 'First Checkbox', 'value' => 1],
                 ['text' => 'Second Checkbox', 'value' => 2]
             ],
-            'optionsLabel' => ['class' => 'custom-class'],
+            'labelOptions' => ['class' => 'custom-class'],
             'value' => ['1']
         ]);
 
@@ -8712,7 +8712,7 @@ class FormHelperTest extends TestCase
                 ['text' => 'First Checkbox', 'value' => 1],
                 ['text' => 'Second Checkbox', 'value' => 2]
             ],
-            'optionsLabel' => ['class' => ['custom-class', 'another-class'], 'data-name' => 'bob'],
+            'labelOptions' => ['class' => ['custom-class', 'another-class'], 'data-name' => 'bob'],
             'value' => ['1']
 
         ]);