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

index eb512c27791deb87a88402f8d1f33de23980a68c..0ce1e1fa8241ebeb940ec688127a1594772a5d91 100644 (file)
@@ -1,4 +1,10 @@
-<input type="text" id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}" class="long"{if $field->isAutofocused()} autofocus{/if}{if $field->isImmutable()} disabled{/if}>
+<input type="text" {*
+       *}id="{@$field->getPrefixedId()}" {*
+       *}name="{@$field->getPrefixedId()}"{*
+       *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+       *}{if $field->isAutofocused()} autofocus{/if}{*
+       *}{if $field->isImmutable()} disabled{/if}{*
+*}>
 
 <script data-relocate="true">
        require(['WoltLabSuite/Core/Ui/ItemList/Static'], function(UiItemListStatic) {
index eb512c27791deb87a88402f8d1f33de23980a68c..0ce1e1fa8241ebeb940ec688127a1594772a5d91 100644 (file)
@@ -1,4 +1,10 @@
-<input type="text" id="{@$field->getPrefixedId()}" name="{@$field->getPrefixedId()}" class="long"{if $field->isAutofocused()} autofocus{/if}{if $field->isImmutable()} disabled{/if}>
+<input type="text" {*
+       *}id="{@$field->getPrefixedId()}" {*
+       *}name="{@$field->getPrefixedId()}"{*
+       *}{if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}{*
+       *}{if $field->isAutofocused()} autofocus{/if}{*
+       *}{if $field->isImmutable()} disabled{/if}{*
+*}>
 
 <script data-relocate="true">
        require(['WoltLabSuite/Core/Ui/ItemList/Static'], function(UiItemListStatic) {
index a82bde0ff4b2050b05c6cc5a8aaeef0670fb59a7..f06141d210d68ec2d61bfebbc828135b9b27f3e1 100644 (file)
@@ -14,8 +14,9 @@ use wcf\util\ArrayUtil;
  * @package    WoltLabSuite\Core\System\Form\Builder\Field
  * @since      5.2
  */
-class ItemListFormField extends AbstractFormField implements IAutoFocusFormField, IImmutableFormField, IMultipleFormField {
+class ItemListFormField extends AbstractFormField implements IAutoFocusFormField, ICssClassFormField, IImmutableFormField, IMultipleFormField {
        use TAutoFocusFormField;
+       use TCssClassFormField;
        use TImmutableFormField;
        use TMultipleFormField;
        
@@ -67,6 +68,7 @@ class ItemListFormField extends AbstractFormField implements IAutoFocusFormField
         */
        public function __construct() {
                $this->multiple();
+               $this->addFieldClass('long');
        }
        
        /**