Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defunct form-* classes #410

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 23 additions & 40 deletions src/View/Helper/FormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,18 @@ class FormHelper extends CoreFormHelper
'{{input}}{{label}}',
'inputContainer' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} {{type}}{{required}}">{{content}}{{help}}</div>',
'class="{{containerClass}}{{type}}{{required}}">{{content}}{{help}}</div>',
'inputContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} {{formGroupPosition}}{{type}}{{required}} is-invalid">' .
'class="{{containerClass}}{{formGroupPosition}}{{type}}{{required}} is-invalid">' .
'{{content}}{{error}}{{help}}</div>',
'checkboxContainer' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} form-check{{variant}} ' .
'class="{{containerClass}}form-check{{variant}} ' .
'{{type}}{{required}}">{{content}}{{help}}</div>',
'checkboxContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} form-check{{variant}} ' .
'class="{{containerClass}}form-check{{variant}} ' .
'{{formGroupPosition}}{{type}}{{required}} is-invalid">' .
'{{content}}{{error}}{{help}}</div>',
'checkboxInlineContainer' =>
Expand All @@ -177,11 +177,11 @@ class FormHelper extends CoreFormHelper
'checkboxInlineWrapper' =>
'<div class="form-check{{variant}} form-check-inline">{{label}}</div>',
'radioContainer' =>
'<div{{containerAttrs}} class="{{containerClass}}{{formGroupClass}} {{type}}{{required}}" role="group" ' .
'<div{{containerAttrs}} class="{{containerClass}}{{type}}{{required}}" role="group" ' .
'aria-labelledby="{{groupId}}">{{content}}{{help}}</div>',
'radioContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} {{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'class="{{containerClass}}{{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'role="group" aria-labelledby="{{groupId}}">{{content}}{{error}}{{help}}</div>',
'radioLabel' =>
'<label{{attrs}}>{{text}}{{tooltip}}</label>',
Expand All @@ -196,16 +196,16 @@ class FormHelper extends CoreFormHelper
'inputGroupText' =>
'<span class="input-group-text">{{content}}</span>',
'multicheckboxContainer' =>
'<div{{containerAttrs}} class="{{containerClass}}{{formGroupClass}} {{type}}{{required}}" role="group" ' .
'<div{{containerAttrs}} class="{{containerClass}}{{type}}{{required}}" role="group" ' .
'aria-labelledby="{{groupId}}">{{content}}{{help}}</div>',
'multicheckboxContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} {{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'class="{{containerClass}}{{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'role="group" aria-labelledby="{{groupId}}">{{content}}{{error}}{{help}}</div>',
'multicheckboxLabel' =>
'<label{{attrs}}>{{text}}{{tooltip}}</label>',
'multicheckboxWrapper' =>
'<fieldset class="%s form-group">{{content}}</fieldset>',
'<fieldset class="%s">{{content}}</fieldset>',
'multicheckboxTitle' =>
'<legend class="col-form-label pt-0">{{text}}</legend>',
'nestingLabel' =>
Expand Down Expand Up @@ -236,31 +236,28 @@ class FormHelper extends CoreFormHelper
'{{formGroupPosition}}{{type}}{{required}} is-invalid">{{content}}{{error}}{{help}}</div>',
'radioContainer' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} ' .
'{{formGroupPosition}}{{type}}{{required}}" ' .
'class="{{containerClass}}{{formGroupPosition}}{{type}}{{required}}" ' .
'role="group" aria-labelledby="{{groupId}}">' .
'{{content}}{{help}}</div>',
'radioContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} ' .
'{{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'class="{{containerClass}}{{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'role="group" aria-labelledby="{{groupId}}">' .
'{{content}}{{error}}{{help}}</div>',
'radioLabel' =>
'<span{{attrs}}>{{text}}{{tooltip}}</span>',
'multicheckboxContainer' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} d-flex {{formGroupPosition}}{{type}}{{required}}" ' .
'class="{{containerClass}}d-flex {{formGroupPosition}}{{type}}{{required}}" ' .
'role="group" aria-labelledby="{{groupId}}">{{content}}{{help}}</div>',
'multicheckboxContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} d-flex ' .
'{{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'class="{{containerClass}}d-flex {{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'role="group" aria-labelledby="{{groupId}}">{{content}}{{error}}{{help}}</div>',
'multicheckboxLabel' =>
'<span{{attrs}}>{{text}}{{tooltip}}</span>',
'multicheckboxWrapper' =>
'<fieldset class="form-group">{{content}}</fieldset>',
'<fieldset>{{content}}</fieldset>',
'multicheckboxTitle' =>
'<legend class="col-form-label float-none pt-0">{{text}}</legend>',
],
Expand All @@ -276,46 +273,37 @@ class FormHelper extends CoreFormHelper
'checkboxInlineFormGroup' =>
'<div class="%s"><div class="form-check{{variant}} form-check-inline">{{input}}{{label}}</div></div>',
'submitContainer' =>
'<div{{containerAttrs}} class="{{containerClass}}{{formGroupClass}} row">' .
'<div class="%s">{{content}}</div></div>',
'<div{{containerAttrs}} class="{{containerClass}}row"><div class="%s">{{content}}</div></div>',
'inputContainer' =>
'<div{{containerAttrs}} class="{{containerClass}}{{formGroupClass}} row {{type}}{{required}}">' .
'<div{{containerAttrs}} class="{{containerClass}}row {{type}}{{required}}">' .
'{{content}}</div>',
'inputContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} row ' .
'{{formGroupPosition}}{{type}}{{required}} is-invalid">' .
'class="{{containerClass}}row {{formGroupPosition}}{{type}}{{required}} is-invalid">' .
'{{content}}</div>',
'checkboxContainer' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} row {{type}}{{required}}">' .
'{{content}}</div>',
'<div{{containerAttrs}} class="{{containerClass}}row {{type}}{{required}}">{{content}}</div>',
'checkboxContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} row ' .
'<div{{containerAttrs}} class="{{containerClass}}row ' .
'{{formGroupPosition}}{{type}}{{required}} is-invalid">' .
'{{content}}</div>',
'radioContainer' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} row {{type}}{{required}}" ' .
'<div{{containerAttrs}} class="{{containerClass}}row {{type}}{{required}}" ' .
'role="group" aria-labelledby="{{groupId}}">' .
'{{content}}</div>',
'radioContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} row ' .
'<div{{containerAttrs}} class="{{containerClass}}row ' .
'{{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'role="group" aria-labelledby="{{groupId}}">' .
'{{content}}</div>',
'radioLabel' =>
'<label{{attrs}}>{{text}}{{tooltip}}</label>',
'multicheckboxContainer' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} row {{type}}{{required}}" ' .
'<div{{containerAttrs}} class="{{containerClass}}row {{type}}{{required}}" ' .
'role="group" aria-labelledby="{{groupId}}">' .
'{{content}}</div>',
'multicheckboxContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}{{formGroupClass}} row ' .
'<div{{containerAttrs}} class="{{containerClass}}row ' .
'{{formGroupPosition}}{{type}}{{required}} is-invalid" ' .
'role="group" aria-labelledby="{{groupId}}">' .
'{{content}}</div>',
Expand Down Expand Up @@ -591,9 +579,6 @@ protected function _containerOptions(?string $fieldName, array $options): array
$containerOptions = $options['container'] ?? [];
unset($options['container']);

$options['templateVars']['formGroupClass'] = $containerOptions['formGroupClass'] ?? 'form-group';
unset($containerOptions['formGroupClass']);

if (isset($containerOptions['class'])) {
$options['templateVars']['containerClass'] = $containerOptions['class'] . ' ';
unset($containerOptions['class']);
Expand Down Expand Up @@ -1299,8 +1284,6 @@ protected function _processFormOptions(array $options): array
return $options;
}

$options = $this->injectClasses('form-' . $this->_align, $options);

if ($this->_align === static::ALIGN_INLINE) {
$options = $this->injectClasses(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function testDefaultAlignCheckboxControl()
'type' => 'checkbox',
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -45,7 +45,7 @@ public function testDefaultAlignCheckboxControlWithDisabledLabel()
'label' => false,
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand All @@ -72,7 +72,7 @@ public function testDefaultAlignCheckboxControlWithCustomLabel()
'label' => 'Custom Label',
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -106,7 +106,7 @@ public function testDefaultAlignCheckboxControlWithCustomLabelOptions()
],
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -140,7 +140,7 @@ public function testDefaultAlignCheckboxControlWithHelp()
'help' => 'Help text',
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -179,7 +179,7 @@ public function testDefaultAlignCheckboxControlWithHelpOptions()
],
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -217,7 +217,7 @@ public function testDefaultAlignCheckboxControlWithTooltip()
'tooltip' => 'Tooltip text',
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -253,7 +253,7 @@ public function testDefaultAlignCheckboxControlWithCustomSpacing()
'spacing' => 'custom-spacing',
]);
$expected = [
['div' => ['class' => 'custom-spacing form-group form-check checkbox']],
['div' => ['class' => 'custom-spacing form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -285,7 +285,7 @@ public function testDefaultAlignCheckboxControlWithError()
'type' => 'checkbox',
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox is-invalid']],
['div' => ['class' => 'mb-3 form-check checkbox is-invalid']],
['input' => [
'class' => 'is-invalid',
'type' => 'hidden',
Expand Down Expand Up @@ -325,7 +325,7 @@ public function testDefaultAlignCheckboxControlWithErrorAndHelp()
'help' => 'Help text',
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox is-invalid']],
['div' => ['class' => 'mb-3 form-check checkbox is-invalid']],
['input' => [
'class' => 'is-invalid',
'type' => 'hidden',
Expand Down Expand Up @@ -372,7 +372,7 @@ public function testDefaultAlignCheckboxControlWithErrorAndHelpAndOptions()
],
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox is-invalid']],
['div' => ['class' => 'mb-3 form-check checkbox is-invalid']],
['input' => [
'class' => 'is-invalid',
'type' => 'hidden',
Expand Down Expand Up @@ -420,7 +420,7 @@ public function testDefaultAlignCheckboxControlContainerOptions()
$expected = [
['div' => [
'attribute' => 'container-attribute',
'class' => 'container-class mb-3 form-group form-check checkbox',
'class' => 'container-class mb-3 form-check checkbox',
]],
['input' => [
'type' => 'hidden',
Expand Down Expand Up @@ -459,7 +459,7 @@ public function testDefaultAlignCheckboxControlContainerOptionsWithError()
$expected = [
['div' => [
'attribute' => 'container-attribute',
'class' => 'container-class mb-3 form-group form-check checkbox is-invalid',
'class' => 'container-class mb-3 form-check checkbox is-invalid',
]],
['input' => [
'class' => 'is-invalid',
Expand Down Expand Up @@ -497,7 +497,7 @@ public function testDefaultAlignCheckboxControlNestedInput()
'nestedInput' => true,
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -528,7 +528,7 @@ public function testDefaultAlignCheckboxControlNestedInputWithTooltip()
'tooltip' => 'Tooltip text',
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox']],
['div' => ['class' => 'mb-3 form-check checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down Expand Up @@ -567,7 +567,7 @@ public function testDefaultAlignCheckboxControlNestedInputWithError()
'nestedInput' => true,
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check checkbox is-invalid']],
['div' => ['class' => 'mb-3 form-check checkbox is-invalid']],
['input' => [
'class' => 'is-invalid',
'type' => 'hidden',
Expand Down Expand Up @@ -1041,7 +1041,7 @@ public function testDefaultAlignCheckboxControlSwitch()
'switch' => true,
]);
$expected = [
['div' => ['class' => 'mb-3 form-group form-check form-switch checkbox']],
['div' => ['class' => 'mb-3 form-check form-switch checkbox']],
['input' => [
'type' => 'hidden',
'name' => 'users',
Expand Down
Loading