Add missing third parameter in `ISelectionFormField::options()`
authorMatthias Schmidt <gravatronics@live.com>
Fri, 17 Aug 2018 13:46:39 +0000 (15:46 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 17 Aug 2018 13:46:39 +0000 (15:46 +0200)
See 855dba8af4282581bc76127c211f279e5dff5f71
See #2509

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

index 1ac84101268e4a00737e79b79072c640e2763c72..8b3fe94b7c46d2cb1436c277893614b51a6bc4ea 100644 (file)
@@ -51,13 +51,13 @@ interface ISelectionFormField {
         * 
         * @param       array|callable|DatabaseObjectList       $options        selectable options or callable returning the options
         * @param       bool                                    $nestedOptions  is `true` if the passed options are nested options
-        *
+        * @param       bool                                    $labelLanguageItems     is `true` if the labels should be treated as language items if possible
         * @return      static                                  this field
         * 
         * @throws      \InvalidArgumentException               if given options are no array or callable or otherwise invalid
         * @throws      \UnexpectedValueException               if callable does not return an array
         */
-       public function options($options, $nestedOptions = false);
+       public function options($options, $nestedOptions = false, $labelLanguageItems = true);
        
        /**
         * Returns `true` if the field class supports nested options and `false` otherwise.
index 2e429f9462b1418d270e9568e022a991a9b0ee99..f309f204abac3df93efaa7a6d6ec6711b2b4b92d 100644 (file)
@@ -63,8 +63,8 @@ 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, $nestedOptions = false) {
-               parent::options($options, $nestedOptions);
+       public function options($options, $nestedOptions = false, $labelLanguageItems = true) {
+               parent::options($options, $nestedOptions, $labelLanguageItems);
                
                $this->__options = [0 => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition')] + $this->__options;
                if ($nestedOptions) {
index 2c8dcd898e2493e944cc499fbd6d9735200066da..df687ee469ecd42c0961f6c55d4f65015a023ff9 100644 (file)
@@ -102,16 +102,27 @@ trait TSelectionFormField {
        }
        
        /**
-        * Sets the possible options of this selection and returns this field.
+        * Sets the possible options of this field and returns this field.
         * 
         * Note: If PHP considers the key of the first selectable option to be empty
         * and the this field is nullable, then the save value of that key is `null`
         * instead of the given empty value.
         * 
-        * @param       array|callable          $options                selectable options or callable returning the options
-        * @param       bool                    $nestedOptions          is `true` if the passed options are nested options
-        * @param       bool                    $labelLanguageItems     is `true` if the labels should be treated as language items if possible
-        * @return      static                                          this field
+        * If a `callable` is passed, it is expected that it either returns an array
+        * or a `DatabaseObjectList` object.
+        * 
+        * If a `DatabaseObjectList` object is passed and `$options->objectIDs === null`,
+        * `$options->readObjects()` is called so that the `readObjects()` does not have
+        * to be called by the API user.
+        * 
+        * If nested options are passed, the given options must be a array or a
+        * callable returning an array. Each array value must be an array with the
+        * following entries: `depth`, `label`, and `value`.
+        * 
+        * @param       array|callable|DatabaseObjectList       $options        selectable options or callable returning the options
+        * @param       bool                                    $nestedOptions  is `true` if the passed options are nested options
+        * @param       bool                                    $labelLanguageItems     is `true` if the labels should be treated as language items if possible
+        * @return      static                                  this field
         * 
         * @throws      \InvalidArgumentException       if given options are no array or callable or otherwise invalid
         * @throws      \UnexpectedValueException       if callable does not return an array