Fix outdated implementation of ShowOrderFormField::options()
authorMatthias Schmidt <gravatronics@live.com>
Fri, 13 Jul 2018 07:06:34 +0000 (09:06 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 13 Jul 2018 07:06:34 +0000 (09:06 +0200)
See #2509

wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php

index f0697f716eef8e630ad632b8f9440e36676a9250..015c2820a68dd199f1929060fa2b36c9a391cb4f 100644 (file)
@@ -64,11 +64,17 @@ class ShowOrderFormField extends SingleSelectionFormField {
         * and using the language item `wcf.form.field.showOrder.firstPosition`
         * as value to mark adding it at the first position.
         */
-       public function options($options): ISelectionFormField {
-               parent::options($options);
+       public function options($options, bool $nestedOptions = false): ISelectionFormField {
+               parent::options($options, $nestedOptions);
                
                $this->__options = [0 => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition')] + $this->__options;
-               $this->possibleValues[] = 0;
+               if ($nestedOptions) {
+                       array_unshift($this->__nestedOptions, [
+                               'depth' => 0,
+                               'label' => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition'),
+                               'value' => 0
+                       ]);
+               }
                
                return $this;
        }