Add field CSS class support for `SingleSelectionFormField`
authorMatthias Schmidt <gravatronics@live.com>
Sun, 20 Dec 2020 09:55:40 +0000 (10:55 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 20 Dec 2020 09:55:40 +0000 (10:55 +0100)
com.woltlab.wcf/templates/__singleSelectionFormField.tpl
wcfsetup/install/files/acp/templates/__singleSelectionFormField.tpl
wcfsetup/install/files/lib/system/form/builder/field/SingleSelectionFormField.class.php

index 6c4f0aad706a182ef7aa5f98dc3bde5f5fa74ed5..bd28656d2d6b1a1d1302fea56cfc08e2b2abe7c2 100644 (file)
@@ -22,6 +22,7 @@
                                                *}type="radio" {*
                                                *}name="{@$field->getPrefixedId()}" {*
                                                *}value="{$__fieldNestedOption[value]}"{*
+                                               *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
                                                *}{if $field->getValue() == $__fieldNestedOption[value] && $__fieldNestedOption[isSelectable]} checked{/if}{*
                                                *}{if $field->isImmutable() || !$__fieldNestedOption[isSelectable]} disabled{/if}{*
                                        *}> {@$__fieldNestedOption[label]}</label>
                {/foreach}
        </ul>
 {else}
-       <select id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}">
+       <select id="{@$field->getPrefixedId()}" {*
+               *}name="{@$field->getPrefixedId()}"{*
+               *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+       *}>
                {foreach from=$field->getNestedOptions() item=__fieldNestedOption}
                        <option {*
                                *}name="{@$field->getPrefixedId()}" {*
index 6c4f0aad706a182ef7aa5f98dc3bde5f5fa74ed5..bd28656d2d6b1a1d1302fea56cfc08e2b2abe7c2 100644 (file)
@@ -22,6 +22,7 @@
                                                *}type="radio" {*
                                                *}name="{@$field->getPrefixedId()}" {*
                                                *}value="{$__fieldNestedOption[value]}"{*
+                                               *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
                                                *}{if $field->getValue() == $__fieldNestedOption[value] && $__fieldNestedOption[isSelectable]} checked{/if}{*
                                                *}{if $field->isImmutable() || !$__fieldNestedOption[isSelectable]} disabled{/if}{*
                                        *}> {@$__fieldNestedOption[label]}</label>
                {/foreach}
        </ul>
 {else}
-       <select id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}">
+       <select id="{@$field->getPrefixedId()}" {*
+               *}name="{@$field->getPrefixedId()}"{*
+               *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+       *}>
                {foreach from=$field->getNestedOptions() item=__fieldNestedOption}
                        <option {*
                                *}name="{@$field->getPrefixedId()}" {*
index eb8540a37d8f778cecaea3197653aabe07b5e959..6e5ffd845a54d97ab6a686cfac1f076f6ab265ab 100644 (file)
@@ -11,7 +11,8 @@ use wcf\system\form\builder\field\validation\FormFieldValidationError;
  * @package    WoltLabSuite\Core\System\Form\Builder\Field
  * @since      5.2
  */
-class SingleSelectionFormField extends AbstractFormField implements IImmutableFormField, IFilterableSelectionFormField, INullableFormField {
+class SingleSelectionFormField extends AbstractFormField implements ICssClassFormField, IImmutableFormField, IFilterableSelectionFormField, INullableFormField {
+       use TCssClassFormField;
        use TImmutableFormField;
        use TFilterableSelectionFormField {
                filterable as protected traitFilterable;