Add field attribute support for `BooleanFormField`
authorMatthias Schmidt <gravatronics@live.com>
Wed, 23 Dec 2020 14:26:58 +0000 (15:26 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 23 Dec 2020 14:26:58 +0000 (15:26 +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 a67c96ff645523fdbe154a5a03f8023977e09ef1..9acc4daa2e801ecbfc03a38226187dd2a8967fda 100644 (file)
@@ -10,6 +10,7 @@
                        *}{if $field->isRequired()} required{/if}{*
                        *}{if $field->isImmutable()} disabled{/if}{*
                        *}{if $field->getValue()} checked{/if}{*
+                       *}{foreach from=$field->getFieldAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
                *}>
                <label for="{@$field->getPrefixedId()}" class="green"><span class="icon icon16 fa-check"></span> {lang}wcf.global.form.boolean.yes{/lang}</label>
        </li>
@@ -21,6 +22,7 @@
                        *}{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}{*
+                       *}{foreach from=$field->getFieldAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
                *}>
                <label for="{@$field->getPrefixedId()}_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.global.form.boolean.no{/lang}</label>
        </li>
index a67c96ff645523fdbe154a5a03f8023977e09ef1..9acc4daa2e801ecbfc03a38226187dd2a8967fda 100644 (file)
@@ -10,6 +10,7 @@
                        *}{if $field->isRequired()} required{/if}{*
                        *}{if $field->isImmutable()} disabled{/if}{*
                        *}{if $field->getValue()} checked{/if}{*
+                       *}{foreach from=$field->getFieldAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
                *}>
                <label for="{@$field->getPrefixedId()}" class="green"><span class="icon icon16 fa-check"></span> {lang}wcf.global.form.boolean.yes{/lang}</label>
        </li>
@@ -21,6 +22,7 @@
                        *}{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}{*
+                       *}{foreach from=$field->getFieldAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{*
                *}>
                <label for="{@$field->getPrefixedId()}_no" class="red"><span class="icon icon16 fa-times"></span> {lang}wcf.global.form.boolean.no{/lang}</label>
        </li>
index 6d9373b25d1fae1808203118e2d42495d0dcae6a..5096f9b36c124eff9abe2240a2d31721937eaa78 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 BooleanFormField extends AbstractFormField implements IAutoFocusFormField, ICssClassFormField, IImmutableFormField {
+class BooleanFormField extends AbstractFormField implements IAttributeFormField, IAutoFocusFormField, ICssClassFormField, IImmutableFormField {
+       use TInputAttributeFormField;
        use TAutoFocusFormField;
        use TCssClassFormField;
        use TImmutableFormField;