Skip to content
Permalink
Browse files

Renamed `optionsLabel` to `labelOptions`

  • Loading branch information...
lilHermit committed Feb 2, 2017
1 parent 9779b57 commit 2606865913b0abcf5f0468fae41a42b2613d1d79
Showing with 14 additions and 14 deletions.
  1. +6 −6 src/View/Helper/FormHelper.php
  2. +8 −8 tests/TestCase/View/Helper/FormHelperTest.php
@@ -1009,7 +1009,7 @@ public function input($fieldName, array $options = [])
'options' => null,
'templates' => [],
'templateVars' => [],
'optionsLabel' => true
'labelOptions' => true
];
$options = $this->_parseOptions($fieldName, $options);
$options += ['id' => $this->_domId($fieldName)];
@@ -1039,8 +1039,8 @@ public function input($fieldName, array $options = [])
$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 @@ public function input($fieldName, array $options = [])
$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 @@ protected function _inputContainerTemplate($options)
*/
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'];
@@ -8498,7 +8498,7 @@ public function testNestedLabelInput()
}
/**
* 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 @@ public function testControlLabelManipulation()
$result = $this->Form->input('test', [
'type' => 'radio',
'options' => ['A', 'B'],
'optionsLabel' => false
'labelOptions' => false
]);
$expected = [
['div' => ['class' => 'input radio']],
@@ -8527,7 +8527,7 @@ public function testControlLabelManipulation()
$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 @@ public function testControlLabelManipulation()
'type' => 'radio',
'options' => ['A', 'B'],
'value' => 1,
'optionsLabel' => ['class' => 'custom-class']
'labelOptions' => ['class' => 'custom-class']
]);
$expected = [
['div' => ['class' => 'input radio']],
@@ -8577,7 +8577,7 @@ public function testControlLabelManipulation()
'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 @@ public function testControlLabelManipulation()
['text' => 'First Checkbox', 'value' => 1],
['text' => 'Second Checkbox', 'value' => 2]
],
'optionsLabel' => false
'labelOptions' => false
]);
$expected = [
['div' => ['class' => 'input select']],
@@ -8660,7 +8660,7 @@ public function testControlLabelManipulation()
['text' => 'First Checkbox', 'value' => 1],
['text' => 'Second Checkbox', 'value' => 2]
],
'optionsLabel' => ['class' => 'custom-class'],
'labelOptions' => ['class' => 'custom-class'],
'value' => ['1']
]);
@@ -8712,7 +8712,7 @@ public function testControlLabelManipulation()
['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']
]);

0 comments on commit 2606865

Please sign in to comment.
You can’t perform that action at this time.