From a0bff0067c3b6c67614ee076d7f7c50444e20053 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 23 Dec 2020 15:26:58 +0100 Subject: [PATCH] Add field attribute support for `BooleanFormField` --- com.woltlab.wcf/templates/__booleanFormField.tpl | 2 ++ wcfsetup/install/files/acp/templates/__booleanFormField.tpl | 2 ++ .../lib/system/form/builder/field/BooleanFormField.class.php | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/com.woltlab.wcf/templates/__booleanFormField.tpl b/com.woltlab.wcf/templates/__booleanFormField.tpl index a67c96ff64..9acc4daa2e 100644 --- a/com.woltlab.wcf/templates/__booleanFormField.tpl +++ b/com.woltlab.wcf/templates/__booleanFormField.tpl @@ -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}{* *}> @@ -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}{* *}> diff --git a/wcfsetup/install/files/acp/templates/__booleanFormField.tpl b/wcfsetup/install/files/acp/templates/__booleanFormField.tpl index a67c96ff64..9acc4daa2e 100644 --- a/wcfsetup/install/files/acp/templates/__booleanFormField.tpl +++ b/wcfsetup/install/files/acp/templates/__booleanFormField.tpl @@ -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}{* *}> @@ -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}{* *}> diff --git a/wcfsetup/install/files/lib/system/form/builder/field/BooleanFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/BooleanFormField.class.php index 6d9373b25d..5096f9b36c 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/BooleanFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/BooleanFormField.class.php @@ -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; -- 2.20.1