From 7162e7b45e5f71477ba0b6568b61747885527a79 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 20 Dec 2020 10:49:01 +0100 Subject: [PATCH] Add field CSS class support for `BooleanFormField` --- .../templates/__booleanFormField.tpl | 21 +++++++++++++++++-- .../acp/templates/__booleanFormField.tpl | 21 +++++++++++++++++-- .../builder/field/BooleanFormField.class.php | 3 ++- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/com.woltlab.wcf/templates/__booleanFormField.tpl b/com.woltlab.wcf/templates/__booleanFormField.tpl index 8902d12b4c..a67c96ff64 100644 --- a/com.woltlab.wcf/templates/__booleanFormField.tpl +++ b/com.woltlab.wcf/templates/__booleanFormField.tpl @@ -1,10 +1,27 @@
  1. - isAutofocused()} autofocus{/if}{if $field->isRequired()} required{/if}{if $field->isImmutable()} disabled{/if}{if $field->getValue()} checked{/if}> + 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}{* + *}>
  2. - isImmutable()} disabled{/if}{if !$field->getValue()} checked{/if}> + getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{* + *}{if $field->isImmutable()} disabled{/if}{* + *}{if !$field->getValue()} checked{/if}{* + *}>
diff --git a/wcfsetup/install/files/acp/templates/__booleanFormField.tpl b/wcfsetup/install/files/acp/templates/__booleanFormField.tpl index 8902d12b4c..a67c96ff64 100644 --- a/wcfsetup/install/files/acp/templates/__booleanFormField.tpl +++ b/wcfsetup/install/files/acp/templates/__booleanFormField.tpl @@ -1,10 +1,27 @@
  1. - isAutofocused()} autofocus{/if}{if $field->isRequired()} required{/if}{if $field->isImmutable()} disabled{/if}{if $field->getValue()} checked{/if}> + 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}{* + *}>
  2. - isImmutable()} disabled{/if}{if !$field->getValue()} checked{/if}> + getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{* + *}{if $field->isImmutable()} disabled{/if}{* + *}{if !$field->getValue()} checked{/if}{* + *}>
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 665acba3f6..6d9373b25d 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,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; /** -- 2.20.1