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

index 8902d12b4c665005df3a3d11aa0d57fc6c2d53c0..a67c96ff645523fdbe154a5a03f8023977e09ef1 100644 (file)
@@ -1,10 +1,27 @@
 <ol class="flexibleButtonGroup">
        <li>
-               <input type="radio" id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}" value="1" data-no-input-id="{@$field->getPrefixedId()}_no"{if $field->isAutofocused()} autofocus{/if}{if $field->isRequired()} required{/if}{if $field->isImmutable()} disabled{/if}{if $field->getValue()} checked{/if}>
+               <input type="radio" {*
+                       *}id="{@$field->getPrefixedId()}" {*
+                       *}name="{@$field->getPrefixedId()}" {*
+                       *}value="1" {*
+                       *}data-no-input-id="{@$field->getPrefixedId()}_no"{*
+                       *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+                       *}{if $field->isAutofocused()} autofocus{/if}{*
+                       *}{if $field->isRequired()} required{/if}{*
+                       *}{if $field->isImmutable()} disabled{/if}{*
+                       *}{if $field->getValue()} checked{/if}{*
+               *}>
                <label for="{@$field->getPrefixedId()}" class="green"><span class="icon icon16 fa-check"></span> {lang}wcf.global.form.boolean.yes{/lang}</label>
        </li>
        <li>
-               <input type="radio" id="{@$field->getPrefixedId()}_no" name="{@$field->getPrefixedId()}" value="0"{if $field->isImmutable()} disabled{/if}{if !$field->getValue()} checked{/if}>
+               <input type="radio" {*
+                       *}id="{@$field->getPrefixedId()}_no" {*
+                       *}name="{@$field->getPrefixedId()}" {*
+                       *}value="0"{*
+                       *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+                       *}{if $field->isImmutable()} disabled{/if}{*
+                       *}{if !$field->getValue()} checked{/if}{*
+               *}>
                <label for="{@$field->getPrefixedId()}_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.global.form.boolean.no{/lang}</label>
        </li>
 </ol>
index 8902d12b4c665005df3a3d11aa0d57fc6c2d53c0..a67c96ff645523fdbe154a5a03f8023977e09ef1 100644 (file)
@@ -1,10 +1,27 @@
 <ol class="flexibleButtonGroup">
        <li>
-               <input type="radio" id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}" value="1" data-no-input-id="{@$field->getPrefixedId()}_no"{if $field->isAutofocused()} autofocus{/if}{if $field->isRequired()} required{/if}{if $field->isImmutable()} disabled{/if}{if $field->getValue()} checked{/if}>
+               <input type="radio" {*
+                       *}id="{@$field->getPrefixedId()}" {*
+                       *}name="{@$field->getPrefixedId()}" {*
+                       *}value="1" {*
+                       *}data-no-input-id="{@$field->getPrefixedId()}_no"{*
+                       *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+                       *}{if $field->isAutofocused()} autofocus{/if}{*
+                       *}{if $field->isRequired()} required{/if}{*
+                       *}{if $field->isImmutable()} disabled{/if}{*
+                       *}{if $field->getValue()} checked{/if}{*
+               *}>
                <label for="{@$field->getPrefixedId()}" class="green"><span class="icon icon16 fa-check"></span> {lang}wcf.global.form.boolean.yes{/lang}</label>
        </li>
        <li>
-               <input type="radio" id="{@$field->getPrefixedId()}_no" name="{@$field->getPrefixedId()}" value="0"{if $field->isImmutable()} disabled{/if}{if !$field->getValue()} checked{/if}>
+               <input type="radio" {*
+                       *}id="{@$field->getPrefixedId()}_no" {*
+                       *}name="{@$field->getPrefixedId()}" {*
+                       *}value="0"{*
+                       *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+                       *}{if $field->isImmutable()} disabled{/if}{*
+                       *}{if !$field->getValue()} checked{/if}{*
+               *}>
                <label for="{@$field->getPrefixedId()}_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.global.form.boolean.no{/lang}</label>
        </li>
 </ol>
index 665acba3f6180e7710abf47ec407c31c13dbfafb..6d9373b25d1fae1808203118e2d42495d0dcae6a 100644 (file)
@@ -11,8 +11,9 @@ use wcf\system\form\builder\field\validation\FormFieldValidationError;
  * @package    WoltLabSuite\Core\System\Form\Builder\Field
  * @since      5.2
  */
-class BooleanFormField extends AbstractFormField implements IAutoFocusFormField, IImmutableFormField {
+class BooleanFormField extends AbstractFormField implements IAutoFocusFormField, ICssClassFormField, IImmutableFormField {
        use TAutoFocusFormField;
+       use TCssClassFormField;
        use TImmutableFormField;
        
        /**