Skip to content

Commit

Permalink
Renamed optionsLabel to labelOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
lilHermit committed Feb 2, 2017
1 parent 9779b57 commit 2606865
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/View/Helper/FormHelper.php
Expand Up @@ -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)];
Expand Down Expand Up @@ -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') {
Expand All @@ -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();
Expand Down Expand Up @@ -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'];
Expand Down
16 changes: 8 additions & 8 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -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
Expand All @@ -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']],
Expand All @@ -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']],
Expand All @@ -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']],
Expand All @@ -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']],
Expand Down Expand Up @@ -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']],
Expand All @@ -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']
]);

Expand Down Expand Up @@ -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']

]);
Expand Down

0 comments on commit 2606865

Please sign in to comment.