*
* @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.
* 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) {
}
/**
- * 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