Skip to content

Commit 2606865

Browse files
committed
Renamed optionsLabel to labelOptions
1 parent 9779b57 commit 2606865

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/View/Helper/FormHelper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ public function input($fieldName, array $options = [])
10091009
'options' => null,
10101010
'templates' => [],
10111011
'templateVars' => [],
1012-
'optionsLabel' => true
1012+
'labelOptions' => true
10131013
];
10141014
$options = $this->_parseOptions($fieldName, $options);
10151015
$options += ['id' => $this->_domId($fieldName)];
@@ -1039,8 +1039,8 @@ public function input($fieldName, array $options = [])
10391039
$label = $options['label'];
10401040
unset($options['label']);
10411041

1042-
$optionsLabel = $options['optionsLabel'];
1043-
unset($options['optionsLabel']);
1042+
$labelOptions = $options['labelOptions'];
1043+
unset($options['labelOptions']);
10441044

10451045
$nestedInput = false;
10461046
if ($options['type'] === 'checkbox') {
@@ -1053,7 +1053,7 @@ public function input($fieldName, array $options = [])
10531053
$options['hiddenField'] = '_split';
10541054
}
10551055

1056-
$input = $this->_getInput($fieldName, $options + ['label' => $optionsLabel]);
1056+
$input = $this->_getInput($fieldName, $options + ['labelOptions' => $labelOptions]);
10571057
if ($options['type'] === 'hidden' || $options['type'] === 'submit') {
10581058
if ($newTemplates) {
10591059
$templater->pop();
@@ -1134,8 +1134,8 @@ protected function _inputContainerTemplate($options)
11341134
*/
11351135
protected function _getInput($fieldName, $options)
11361136
{
1137-
$label = $options['label'];
1138-
unset($options['label']);
1137+
$label = $options['labelOptions'];
1138+
unset($options['labelOptions']);
11391139
switch (strtolower($options['type'])) {
11401140
case 'select':
11411141
$opts = $options['options'];

tests/TestCase/View/Helper/FormHelperTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8498,7 +8498,7 @@ public function testNestedLabelInput()
84988498
}
84998499

85008500
/**
8501-
* Tests to make sure `optionsLabel` is rendered correctly by MultiCheckboxWidget and RadioWidget
8501+
* Tests to make sure `labelOptions` is rendered correctly by MultiCheckboxWidget and RadioWidget
85028502
*
85038503
* Tests false, class (as string and array) also makes sure 'selected' is added to the class if checked.
85048504
* Also checks to make sure any custom attributes are rendered
@@ -8509,7 +8509,7 @@ public function testControlLabelManipulation()
85098509
$result = $this->Form->input('test', [
85108510
'type' => 'radio',
85118511
'options' => ['A', 'B'],
8512-
'optionsLabel' => false
8512+
'labelOptions' => false
85138513
]);
85148514
$expected = [
85158515
['div' => ['class' => 'input radio']],
@@ -8527,7 +8527,7 @@ public function testControlLabelManipulation()
85278527
$result = $this->Form->input('test', [
85288528
'type' => 'radio',
85298529
'options' => ['A', 'B'],
8530-
'optionsLabel' => ['class' => 'custom-class']
8530+
'labelOptions' => ['class' => 'custom-class']
85318531
]);
85328532
$expected = [
85338533
['div' => ['class' => 'input radio']],
@@ -8552,7 +8552,7 @@ public function testControlLabelManipulation()
85528552
'type' => 'radio',
85538553
'options' => ['A', 'B'],
85548554
'value' => 1,
8555-
'optionsLabel' => ['class' => 'custom-class']
8555+
'labelOptions' => ['class' => 'custom-class']
85568556
]);
85578557
$expected = [
85588558
['div' => ['class' => 'input radio']],
@@ -8577,7 +8577,7 @@ public function testControlLabelManipulation()
85778577
'type' => 'radio',
85788578
'options' => ['A', 'B'],
85798579
'value' => 1,
8580-
'optionsLabel' => ['class' => ['custom-class', 'custom-class-array']]
8580+
'labelOptions' => ['class' => ['custom-class', 'custom-class-array']]
85818581
]);
85828582
$expected = [
85838583
['div' => ['class' => 'input radio']],
@@ -8633,7 +8633,7 @@ public function testControlLabelManipulation()
86338633
['text' => 'First Checkbox', 'value' => 1],
86348634
['text' => 'Second Checkbox', 'value' => 2]
86358635
],
8636-
'optionsLabel' => false
8636+
'labelOptions' => false
86378637
]);
86388638
$expected = [
86398639
['div' => ['class' => 'input select']],
@@ -8660,7 +8660,7 @@ public function testControlLabelManipulation()
86608660
['text' => 'First Checkbox', 'value' => 1],
86618661
['text' => 'Second Checkbox', 'value' => 2]
86628662
],
8663-
'optionsLabel' => ['class' => 'custom-class'],
8663+
'labelOptions' => ['class' => 'custom-class'],
86648664
'value' => ['1']
86658665
]);
86668666

@@ -8712,7 +8712,7 @@ public function testControlLabelManipulation()
87128712
['text' => 'First Checkbox', 'value' => 1],
87138713
['text' => 'Second Checkbox', 'value' => 2]
87148714
],
8715-
'optionsLabel' => ['class' => ['custom-class', 'another-class'], 'data-name' => 'bob'],
8715+
'labelOptions' => ['class' => ['custom-class', 'another-class'], 'data-name' => 'bob'],
87168716
'value' => ['1']
87178717

87188718
]);

0 commit comments

Comments
 (0)