diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3476a0a71..af27cea62 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - 4.x pull_request: paths-ignore: - "**.md" diff --git a/src/TwbsHelper/Form/View/Helper/FormRow.php b/src/TwbsHelper/Form/View/Helper/FormRow.php index c7de53601..2b0a15ff2 100644 --- a/src/TwbsHelper/Form/View/Helper/FormRow.php +++ b/src/TwbsHelper/Form/View/Helper/FormRow.php @@ -85,8 +85,6 @@ public function render(\Laminas\Form\ElementInterface $element, ?string $labelPo switch (true) { // Form group disabled case $element->getOption('form_group') === false: - // Radio elements - case $elementType === 'radio': // All "button" elements in inline form case in_array($elementType, ['submit', 'button', 'reset'], true) && $layout === \TwbsHelper\Form\View\Helper\Form::LAYOUT_INLINE: @@ -305,9 +303,12 @@ protected function getDefaultLabelPosition(\Laminas\Form\ElementInterface $eleme } } + if ($element instanceof \Laminas\Form\Element\MultiCheckbox) { + return self::LABEL_PREPEND; + } + switch ($element->getAttribute('type')) { case 'checkbox': - case 'radio': return self::LABEL_APPEND; case 'file': if ($element->getOption('custom')) { diff --git a/tests/TestSuite/Documentation/Tests/Components/Forms/CustomForms.php b/tests/TestSuite/Documentation/Tests/Components/Forms/CustomForms.php index d69265aab..87f74776a 100644 --- a/tests/TestSuite/Documentation/Tests/Components/Forms/CustomForms.php +++ b/tests/TestSuite/Documentation/Tests/Components/Forms/CustomForms.php @@ -40,6 +40,7 @@ 'name' => 'customRadio', 'type' => 'radio', 'options' => [ + 'form_group' => false, 'custom' => true, 'value_options' => [ [ @@ -68,6 +69,7 @@ 'type' => 'radio', 'options' => [ 'layout' => \TwbsHelper\Form\View\Helper\Form::LAYOUT_INLINE, + 'form_group' => false, 'custom' => true, 'value_options' => [ [ @@ -110,6 +112,7 @@ 'name' => 'radioDisabled', 'type' => 'radio', 'options' => [ + 'form_group' => false, 'custom' => true, 'value_options' => [ [ diff --git a/tests/TestSuite/Documentation/Tests/Components/Forms/Layout/FormGrid/HorizontalForm.php b/tests/TestSuite/Documentation/Tests/Components/Forms/Layout/FormGrid/HorizontalForm.php index b046b65dc..ada04ecde 100644 --- a/tests/TestSuite/Documentation/Tests/Components/Forms/Layout/FormGrid/HorizontalForm.php +++ b/tests/TestSuite/Documentation/Tests/Components/Forms/Layout/FormGrid/HorizontalForm.php @@ -53,7 +53,6 @@ 'type' => 'radio', 'name' => 'gridRadios', 'options' => [ - 'column' => 'sm-10', 'value_options' => [ [ 'label' => 'First radio', diff --git a/tests/TestSuite/Documentation/__snapshots__/Components/Forms/Layout/Form_grid/Horizontal_form__1.html b/tests/TestSuite/Documentation/__snapshots__/Components/Forms/Layout/Form_grid/Horizontal_form__1.html index 3fe4df1b1..d579a6237 100644 --- a/tests/TestSuite/Documentation/__snapshots__/Components/Forms/Layout/Form_grid/Horizontal_form__1.html +++ b/tests/TestSuite/Documentation/__snapshots__/Components/Forms/Layout/Form_grid/Horizontal_form__1.html @@ -16,17 +16,19 @@