Run php-cs-fixer for the event listener
authorCyperghost <olaf_schmitz_1@t-online.de>
Fri, 2 Aug 2024 13:35:42 +0000 (15:35 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Fri, 2 Aug 2024 13:35:42 +0000 (15:35 +0200)
com.woltlab.wcf/templates/shared_multipleSelectFormField.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectFormField.class.php [new file with mode: 0644]

diff --git a/com.woltlab.wcf/templates/shared_multipleSelectFormField.tpl b/com.woltlab.wcf/templates/shared_multipleSelectFormField.tpl
new file mode 100644 (file)
index 0000000..b83137e
--- /dev/null
@@ -0,0 +1,16 @@
+<select
+       id="{$field->getPrefixedId()}"
+       name="{$field->getPrefixedId()}"
+       {if !$field->getFieldClasses()|empty} class="{implode from=$field->getFieldClasses() item='class' glue=' '}{$class}{/implode}"{/if}
+       {if $field->isRequired()} required{/if}
+       multiple
+>
+       <option value="">{lang}wcf.global.noSelection{/lang}</option>
+       {foreach from=$field->getNestedOptions() item=__fieldNestedOption}
+               <option
+                       value="{$__fieldNestedOption[value]}"
+                       {if $field->getValue() == $__fieldNestedOption[value] && $__fieldNestedOption[isSelectable]} selected{/if}
+                       {if $field->isImmutable() || !$__fieldNestedOption[isSelectable]} disabled{/if}
+               >{@'&nbsp;'|str_repeat:$__fieldNestedOption[depth] * 4}{@$__fieldNestedOption[label]}</option>
+       {/foreach}
+</select>
diff --git a/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/MultipleSelectFormField.class.php
new file mode 100644 (file)
index 0000000..fa6ba7a
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace wcf\system\form\builder\field;
+
+/**
+ * Implementation of a form field for selecting multiple values in a select input field.
+ *
+ * @author      Olaf Braun
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @since       6.1
+ */
+class MultipleSelectFormField extends MultipleSelectionFormField
+{
+    /**
+     * @inheritDoc
+     */
+    protected $javaScriptDataHandlerModule = '';
+
+    /**
+     * @inheritDoc
+     */
+    protected $templateName = 'shared_multipleSelectFormField';
+}