Skip to content

Commit 9aed575

Browse files
committed
Fix outdated documentation for MultipleSelectionFormField
Closes #302
1 parent a441e34 commit 9aed575

File tree

1 file changed

+12
-65
lines changed

1 file changed

+12
-65
lines changed

docs/php/api/form_builder/form_fields.md

Lines changed: 12 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22

33
## Abstract Form Fields
44

5-
The following form field classes cannot be instantiated directly because they are abstract, but they can/must be used when creating own form field classes.
6-
5+
The following form field classes cannot be instantiated directly because they are abstract, but they can/must be used when creating own form field classes.
76

87
### `AbstractFormField`
98

109
`AbstractFormField` is the abstract default implementation of the `IFormField` interface and it is expected that every implementation of `IFormField` implements the interface by extending this class.
1110

12-
1311
### `AbstractNumericFormField`
1412

1513
`AbstractNumericFormField` is the abstract implementation of a form field handling a single numeric value.
@@ -31,22 +29,19 @@ If the implementation of a more specific interface is required then the remainin
3129

3230
The following form fields are general reusable fields without any underlying context.
3331

34-
3532
### `BooleanFormField`
3633

3734
`BooleanFormField` is used for boolean (`0` or `1`, `yes` or `no`) values.
3835
Objects of this class require a label.
3936
The return value of `getSaveValue()` is the integer representation of the boolean value, i.e. `0` or `1`.
4037
The class implements `IAttributeFormField`, `IAutoFocusFormField`, `ICssClassFormField`, and `IImmutableFormField`.
4138

42-
4339
### `CheckboxFormField`
4440

4541
!!! info "Only available since version 5.3.2."
4642

4743
`CheckboxFormField` extends `BooleanFormField` and offers a simple HTML checkbox.
4844

49-
5045
### `ClassNameFormField`
5146

5247
`ClassNameFormField` is a [text form field](#textformfield) that supports additional settings, specific to entering a PHP class name:
@@ -62,7 +57,6 @@ The class implements `IAttributeFormField`, `IAutoFocusFormField`, `ICssClassFor
6257

6358
Additionally, the default id of a `ClassNameFormField` object is `className`, the default label is `wcf.form.field.className`, and if either an interface or a parent class is required, a default description is set if no description has already been set (`wcf.form.field.className.description.interface` and `wcf.form.field.className.description.parentClass`, respectively).
6459

65-
6660
### `DateFormField`
6761

6862
`DateFormField` is a form field to enter a date (and optionally a time).
@@ -78,45 +72,37 @@ The following methods are specific to this form field class:
7872
- `supportTime($supportsTime = true)` and `supportsTime()` can be used to toggle whether, in addition to a date, a time can also be specified.
7973
By default, specifying a time is disabled.
8074

81-
8275
### `DescriptionFormField`
8376

8477
`DescriptionFormField` is a [multi-line text form field](#multilinetextformfield) with `description` as the default id and `wcf.global.description` as the default label.
8578

86-
8779
### `EmailFormField`
8880

8981
`EmailFormField` is a form field to enter an email address which is internally validated using `UserUtil::isValidEmail()`.
9082
The class implements `IAttributeFormField`, `IAutoCompleteFormField`, `IAutoFocusFormField`, `ICssClassFormField`, `II18nFormField`, `IImmutableFormField`, `IInputModeFormField`, `IPatternFormField`, and `IPlaceholderFormField`.
9183

92-
9384
### `FloatFormField`
9485

9586
`FloatFormField` is an implementation of [AbstractNumericFormField](#abstractnumericformfield) for floating point numbers.
9687

97-
9888
### `HiddenFormField`
9989

10090
`HiddenFormField` is a form field without any user-visible UI.
10191
Even though the form field is invisible to the user, the value can still be modified by the user, e.g. by leveraging the web browsers developer tools.
102-
The `HiddenFormField` *must not* be used to transfer sensitive information or information that the user should not be able to modify.
103-
92+
The `HiddenFormField` _must not_ be used to transfer sensitive information or information that the user should not be able to modify.
10493

10594
### `IconFormField`
10695

10796
`IconFormField` is a form field to select a FontAwesome icon.
10897

109-
11098
### `IntegerFormField`
11199

112100
`IntegerFormField` is an implementation of [AbstractNumericFormField](#abstractnumericformfield) for integers.
113101

114-
115102
### `IsDisabledFormField`
116103

117104
`IsDisabledFormField` is a [boolean form field](#booleanformfield) with `isDisabled` as the default id.
118105

119-
120106
### `ItemListFormField`
121107

122108
`ItemListFormField` is a form field in which multiple values can be entered and returned in different formats as save value.
@@ -133,28 +119,23 @@ By default, `ItemListFormField::SAVE_VALUE_TYPE_CSV` is used.
133119

134120
If `ItemListFormField::SAVE_VALUE_TYPE_ARRAY` is used as save value type, `ItemListFormField` objects register a [custom form field data processor](validation_data.md#customformfielddataprocessor) to add the relevant array into the `$parameters` array directly using the object property as the array key.
135121

136-
137122
### `MultilineTextFormField`
138123

139124
`MultilineTextFormField` is a [text form field](#textformfield) that supports multiple rows of text.
140125
The methods `rows($rows)` and `getRows()` can be used to set and get the number of rows of the `textarea` elements.
141126
The default number of rows is `10`.
142127
These methods do **not**, however, restrict the number of text rows that can be entered.
143128

144-
145129
### `MultipleSelectionFormField`
146130

147131
`MultipleSelectionFormField` is a form fields that allows the selection of multiple options out of a predefined list of available options.
148-
The class implements `IAttributeFormField`, `ICssClassFormField`, `IFilterableSelectionFormField`, `IImmutableFormField`, and `INullableFormField`.
149-
If the field is nullable and no option is selected, `null` is returned as the save value.
150-
132+
The class implements `IAttributeFormField`, `ICssClassFormField`, `IFilterableSelectionFormField`, `IImmutableFormField`.
151133

152134
### `RadioButtonFormField`
153135

154136
`RadioButtonFormField` is a form fields that allows the selection of a single option out of a predefined list of available options using radiobuttons.
155137
The class implements `IAttributeFormField`, `ICssClassFormField`, `IImmutableFormField`, and `ISelectionFormField`.
156138

157-
158139
### `RatingFormField`
159140

160141
`RatingFormField` is a form field to set a rating for an object.
@@ -163,8 +144,7 @@ Form fields of this class have `rating` as their default id, `wcf.form.field.rat
163144
For this field, the minimum and maximum refer to the minimum and maximum rating an object can get.
164145
When the field is shown, there will be `maximum() - minimum() + 1` icons be shown with additional CSS classes that can be set and gotten via `defaultCssClasses(array $cssClasses)` and `getDefaultCssClasses()`.
165146
If a rating values is set, the first `getValue()` icons will instead use the classes that can be set and gotten via `activeCssClasses(array $cssClasses)` and `getActiveCssClasses()`.
166-
By default, the only default class is `fa-star-o` and the active classes are `fa-star` and `orange`.
167-
147+
By default, the only default class is `fa-star-o` and the active classes are `fa-star` and `orange`.
168148

169149
### `ShowOrderFormField`
170150

@@ -175,41 +155,33 @@ The default id of instances of this class is `showOrder` and their default label
175155

176156
!!! info "It is important that the relevant object property is always kept updated. Whenever a new object is added or an existing object is edited or delete, the values of the other objects have to be adjusted to ensure consecutive numbering."
177157

178-
179158
### `SingleSelectionFormField`
180159

181160
`SingleSelectionFormField` is a form fields that allows the selection of a single option out of a predefined list of available options.
182161
The class implements `ICssClassFormField`, `IFilterableSelectionFormField`, `IImmutableFormField`, and `INullableFormField`.
183162
If the field is nullable and the current form field value is considered `empty` by PHP, `null` is returned as the save value.
184163

185-
186164
### `SortOrderFormField`
187165

188166
`SingleSelectionFormField` is a [single selection form field](#singleselectionformfield) with default id `sortOrder`, default label `wcf.global.showOrder` and default options `ASC: wcf.global.sortOrder.ascending` and `DESC: wcf.global.sortOrder.descending`.
189167

190-
191168
### `TextFormField`
192169

193170
`TextFormField` is a form field that allows entering a single line of text.
194171
The class implements `IAttributeFormField`, `IAutoCompleteFormField`, `ICssClassFormField`, `IImmutableFormField`, `II18nFormField`, `IInputModeFormField`, `IMaximumLengthFormField`, `IMinimumLengthFormField`, `IPatternFormField`, and `IPlaceholderFormField`.
195172

196-
197173
### `TitleFormField`
198174

199175
`TitleFormField` is a [text form field](#textformfield) with `title` as the default id and `wcf.global.title` as the default label.
200176

201-
202177
### `UrlFormField`
203178

204179
`UrlFormField` is a [text form field](#textformfield) whose values are checked via `Url::is()`.
205180

206-
207-
208181
## Specific Fields
209182

210183
The following form fields are reusable fields that generally are bound to a certain API or `DatabaseObject` implementation.
211184

212-
213185
### `AclFormField`
214186

215187
`AclFormField` is used for setting up acl values for specific objects.
@@ -222,39 +194,34 @@ A category name of `null` signals that no category filter is used.
222194
`AclFormField` objects register a [custom form field data processor](validation_data.md#customformfielddataprocessor) to add the relevant ACL object type id into the `$parameters` array directly using `{$objectProperty}_aclObjectTypeID` as the array key.
223195
The relevant database object action method is expected, based on the given ACL object type id, to save the ACL option values appropriately.
224196

225-
226197
### `ButtonFormField`
227198

228199
!!! info "Only available since version 5.4."
229200

230201
`ButtonFormField` shows a submit button as part of the form.
231202
The class implements `IAttributeFormField` and `ICssClassFormField`.
232203

233-
Specifically for this form field, there is the `IsNotClickedFormFieldDependency` dependency with which certain parts of the form will only be processed if the relevent button has not clicked.
234-
204+
Specifically for this form field, there is the `IsNotClickedFormFieldDependency` dependency with which certain parts of the form will only be processed if the relevent button has not clicked.
235205

236206
### `CaptchaFormField`
237207

238208
`CaptchaFormField` is used to add captcha protection to the form.
239209

240210
You must specify a captcha object type (`com.woltlab.wcf.captcha`) using the `objectType()` method.
241211

242-
243212
### `ColorFormField`
244213

245214
!!! info "Only available since version 5.5."
246215

247216
`ColorFormField` is used to specify RGBA colors using the `rgba(r, g, b, a)` format.
248217
The class implements `IImmutableFormField`.
249218

250-
251219
### `ContentLanguageFormField`
252220

253221
`ContentLanguageFormField` is used to select the content language of an object.
254-
Fields of this class are only available if multilingualism is enabled and if there are content languages.
222+
Fields of this class are only available if multilingualism is enabled and if there are content languages.
255223
The class implements `IImmutableFormField`.
256224

257-
258225
### `LabelFormField`
259226

260227
`LabelFormField` is used to select a label from a specific label group.
@@ -264,14 +231,12 @@ The `labelGroup(ViewableLabelGroup $labelGroup)` and `getLabelGroup()` methods a
264231
Additionally, there is the static method `createFields($objectType, array $labelGroups, $objectProperty = 'labelIDs)` that can be used to create all relevant label form fields for a given list of label groups.
265232
In most cases, `LabelFormField::createFields()` should be used.
266233

267-
268234
### `OptionFormField`
269235

270236
`OptionFormField` is an [item list form field](#itemlistformfield) to set a list of options.
271237
The class implements `IPackagesFormField` and only options of the set packages are considered available.
272238
The default label of instances of this class is `wcf.form.field.option` and their default id is `options`.
273239

274-
275240
### `SimpleAclFormField`
276241

277242
`SimpleAclFormField` is used for setting up simple acl values (one `yes`/`no` option per user and user group) for specific objects.
@@ -292,7 +257,6 @@ The following methods are specific to this form field class:
292257
- `imageOnly($imageOnly = true)` and `isImageOnly()` can be used to set and check if only images may be selected.
293258
- `getMedia()` returns the media file based on the current field value if a field is set.
294259

295-
296260
### `TagFormField`
297261

298262
`TagFormField` is a form field to enter tags.
@@ -302,57 +266,51 @@ The default label of instances of this class is `wcf.tagging.tags` and their def
302266

303267
`TagFormField` objects register a [custom form field data processor](validation_data.md#customformfielddataprocessor) to add the array with entered tag names into the `$parameters` array directly using the object property as the array key.
304268

305-
306269
### `UploadFormField`
307270

308271
`UploadFormField` is a form field that allows uploading files by the user.
309272

310-
`UploadFormField` objects register a [custom form field data processor](validation_data.md#customformfielddataprocessor) to add the array of `wcf\system\file\upload\UploadFile\UploadFile` into the `$parameters` array directly using the object property as the array key. Also it registers the removed files as an array of `wcf\system\file\upload\UploadFile\UploadFile` into the `$parameters` array directly using the object property with the suffix `_removedFiles` as the array key.
273+
`UploadFormField` objects register a [custom form field data processor](validation_data.md#customformfielddataprocessor) to add the array of `wcf\system\file\upload\UploadFile\UploadFile` into the `$parameters` array directly using the object property as the array key. Also it registers the removed files as an array of `wcf\system\file\upload\UploadFile\UploadFile` into the `$parameters` array directly using the object property with the suffix `_removedFiles` as the array key.
274+
275+
The field supports additional settings:
311276

312-
The field supports additional settings:
313277
- `imageOnly($imageOnly = true)` and `isImageOnly()` can be used to ensure that the uploaded files are only images.
314278
- `allowSvgImage($allowSvgImages = true)` and `svgImageAllowed()` can be used to allow SVG images, if the image only mode is enabled (otherwise, the method will throw an exception). By default, SVG images are not allowed.
315279

316-
#### Provide value from database object
280+
#### Provide value from database object
317281

318282
To provide values from a database object, you should implement the method `get{$objectProperty}UploadFileLocations()` to your database object class. This method must return an array of strings with the locations of the files.
319283

320-
#### Process files
284+
#### Process files
321285

322286
To process files in the database object action class, you must [`rename`](https://secure.php.net/manual/en/function.rename.php) the file to the final destination. You get the temporary location, by calling the method `getLocation()` on the given `UploadFile` objects. After that, you call `setProcessed($location)` with `$location` contains the new file location. This method sets the `isProcessed` flag to true and saves the new location. For updating files, it is relevant, whether a given file is already processed or not. For this case, the `UploadFile` object has an method `isProcessed()` which indicates, whether a file is already processed or new uploaded.
323287

324-
325288
### `UserFormField`
326289

327290
`UserFormField` is a form field to enter existing users.
328291
The class implements `IAutoCompleteFormField`, `IAutoFocusFormField`, `IImmutableFormField`, `IMultipleFormField`, and `INullableFormField`.
329292
While the user is presented the names of the specified users in the user interface, the field returns the ids of the users as data.
330293
The relevant `UserProfile` objects can be accessed via the `getUsers()` method.
331294

332-
333295
### `UserPasswordField`
334296

335297
!!! info "Only available since version 5.4."
336298

337299
`UserPasswordField` is a form field for users' to enter their current password.
338300
The class implements `IAttributeFormField`, `IAttributeFormField`, `IAutoCompleteFormField`, `IAutoFocusFormField`, and `IPlaceholderFormField`
339301

340-
341302
### `UserGroupOptionFormField`
342303

343304
`UserGroupOptionFormField` is an [item list form field](#itemlistformfield) to set a list of user group options/permissions.
344305
The class implements `IPackagesFormField` and only user group options of the set packages are considered available.
345306
The default label of instances of this class is `wcf.form.field.userGroupOption` and their default id is `permissions`.
346307

347-
348308
### `UsernameFormField`
349309

350310
`UsernameFormField` is used for entering one non-existing username.
351311
The class implements `IAttributeFormField`, `IImmutableFormField`, `IMaximumLengthFormField`, `IMinimumLengthFormField`, `INullableFormField`, and `IPlaceholderFormField`.
352312
As usernames have a system-wide restriction of a minimum length of 3 and a maximum length of 100 characters, these values are also used as the default value for the field’s minimum and maximum length.
353313

354-
355-
356314
## Wysiwyg form container
357315

358316
To integrate a wysiwyg editor into a form, you have to create a `WysiwygFormContainer` object.
@@ -435,7 +393,6 @@ WysiwygFormContainer::create('message')
435393
->supportQuotes()
436394
```
437395

438-
439396
### `WysiwygFormField`
440397

441398
`WysiwygFormField` is used for wysiwyg editor form fields.
@@ -449,20 +406,17 @@ The following methods are specific to this form field class:
449406
`0` signals that no last edit time has been set.
450407
- `supportAttachments($supportAttachments)` and `supportsAttachments()` can be used to set and check if the form field supports attachments.
451408

452-
!!! warning "It is not sufficient to simply signal attachment support via these methods for attachments to work. These methods are relevant internally to signal the Javascript code that the editor supports attachments. Actual attachment support is provided by `WysiwygAttachmentFormField`."
409+
!!! warning "It is not sufficient to simply signal attachment support via these methods for attachments to work. These methods are relevant internally to signal the Javascript code that the editor supports attachments. Actual attachment support is provided by `WysiwygAttachmentFormField`."
453410

454411
- `supportMentions($supportMentions)` and `supportsMentions()` can be used to set and check if the form field supports mentions of other users.
455412

456413
`WysiwygFormField` objects register a [custom form field data processor](validation_data.md#customformfielddataprocessor) to add the relevant simple ACL data array into the `$parameters` array directly using the object property as the array key.
457414

458-
459415
### `TWysiwygFormNode`
460416

461417
All form nodes that need to know the id of the `WysiwygFormField` field should use `TWysiwygFormNode`.
462418
This trait provides `getWysiwygId()` and `wysiwygId($wysiwygId)` to get and set the relevant wysiwyg editor id.
463419

464-
465-
466420
## Application-Specific Form Fields
467421

468422
### WoltLab Suite Forum
@@ -485,33 +439,26 @@ The field supports additional settings:
485439
By default, external links are shown.
486440
Like in the example given before, in cases where only actual boards, in which threads can be posted, are relevant, this option allows to exclude external links.
487441

488-
489-
490442
## Single-Use Form Fields
491443

492444
The following form fields are specific for certain forms and hardly reusable in other contexts.
493445

494-
495446
### `BBCodeAttributesFormField`
496447

497448
`DevtoolsProjectExcludedPackagesFormField` is a form field for setting the attributes of a BBCode.
498449

499-
500450
### `DevtoolsProjectExcludedPackagesFormField`
501451

502452
`DevtoolsProjectExcludedPackagesFormField` is a form field for setting the excluded packages of a devtools project.
503453

504-
505454
### `DevtoolsProjectInstructionsFormField`
506455

507456
`DevtoolsProjectExcludedPackagesFormField` is a form field for setting the installation and update instructions of a devtools project.
508457

509-
510458
### `DevtoolsProjectOptionalPackagesFormField`
511459

512460
`DevtoolsProjectExcludedPackagesFormField` is a form field for setting the optional packages of a devtools project.
513461

514-
515462
### `DevtoolsProjectRequiredPackagesFormField`
516463

517464
`DevtoolsProjectExcludedPackagesFormField` is a form field for setting the required packages of a devtools project.

0 commit comments

Comments
 (0)