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

index af2e22d07329fddd519b783d1827082cd24605eb..c9348455f5f176caf14c46f62f88839ecbfba6ea 100644 (file)
@@ -2,7 +2,15 @@
        <dt></dt>
        <dd>
                <label>
-                       <input type="checkbox" id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}" value="1"{if $field->isRequired()} required{/if}{if $field->isImmutable()} disabled{/if}{if $field->getValue()} checked{/if}>
+                       <input type="checkbox" {*
+                               *}id="{@$field->getPrefixedId()}" {*
+                               *}name="{@$field->getPrefixedId()}" {*
+                               *}value="1"{*
+                               *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+                               *}{if $field->isRequired()} required{/if}{*
+                               *}{if $field->isImmutable()} disabled{/if}{*
+                               *}{if $field->getValue()} checked{/if}{*
+                       *}>
                        {@$field->getLabel()}{if $field->isRequired()} <span class="formFieldRequired">*</span>{/if}
                </label>
                
index af2e22d07329fddd519b783d1827082cd24605eb..c9348455f5f176caf14c46f62f88839ecbfba6ea 100644 (file)
@@ -2,7 +2,15 @@
        <dt></dt>
        <dd>
                <label>
-                       <input type="checkbox" id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}" value="1"{if $field->isRequired()} required{/if}{if $field->isImmutable()} disabled{/if}{if $field->getValue()} checked{/if}>
+                       <input type="checkbox" {*
+                               *}id="{@$field->getPrefixedId()}" {*
+                               *}name="{@$field->getPrefixedId()}" {*
+                               *}value="1"{*
+                               *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+                               *}{if $field->isRequired()} required{/if}{*
+                               *}{if $field->isImmutable()} disabled{/if}{*
+                               *}{if $field->getValue()} checked{/if}{*
+                       *}>
                        {@$field->getLabel()}{if $field->isRequired()} <span class="formFieldRequired">*</span>{/if}
                </label>
                
index 7df2a5b09e20fcd7754b03cd2ef6856d13bd4b7d..6e541b716b8d1e31400d044e92c4ce5961525205 100644 (file)
@@ -11,7 +11,9 @@ use wcf\system\WCF;
  * @package    WoltLabSuite\Core\System\Form\Builder\Field
  * @since      5.3
  */
-class CheckboxFormField extends BooleanFormField {
+class CheckboxFormField extends BooleanFormField implements ICssClassFormField {
+       use TCssClassFormField;
+       
        /**
         * @inheritDoc
         */