From: Matthias Schmidt Date: Fri, 17 Aug 2018 13:46:39 +0000 (+0200) Subject: Add missing third parameter in `ISelectionFormField::options()` X-Git-Tag: 5.2.0_Alpha_1~364^2~75 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dd58e504b721cf26db4228c49bdb57835182faaa;p=GitHub%2FWoltLab%2FWCF.git Add missing third parameter in `ISelectionFormField::options()` See 855dba8af4282581bc76127c211f279e5dff5f71 See #2509 --- diff --git a/wcfsetup/install/files/lib/system/form/builder/field/ISelectionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/ISelectionFormField.class.php index 1ac8410126..8b3fe94b7c 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/ISelectionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/ISelectionFormField.class.php @@ -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. diff --git a/wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php index 2e429f9462..f309f204ab 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/ShowOrderFormField.class.php @@ -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) { diff --git a/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php b/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php index 2c8dcd898e..df687ee469 100644 --- a/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php +++ b/wcfsetup/install/files/lib/system/form/builder/field/TSelectionFormField.class.php @@ -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