You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/php/api/form_builder/form_fields.md
+38Lines changed: 38 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -520,6 +520,44 @@ Example:
520
520
ContentLanguageFormField::create()
521
521
```
522
522
523
+
### FileProcessorFormField
524
+
525
+
The `FileProcessorFormField` is used to upload files to the server via the file processor.
526
+
527
+
By default, `FileProcessorFormField` objects register a [custom form field data processor](validation_data.md#customformfielddataprocessor) to add the appropriate array of fileIDs to the `$parameters` array directly, using the object property as the array key.
528
+
If `isSingleFileUpload()` is enabled, the value will be added to the data sub-array of the parameters array and the value can be null.
529
+
530
+
The checks for the correct file size or extension don't take place in the FormField, this must be defined in the `IFileProcessor`.
531
+
532
+
__The field supports other settings:__
533
+
534
+
-`bigPreview($bigPreview = true)` and `isBigPreview()` can be used to set and check if the big preview is enabled. The big preview can only be enabled if single file upload is enabled and the file processor only supports images.
535
+
-`context(array $context)` and `getContext()` can be used to set and get the context of the file processor.
536
+
-`singleFileUpload($singleFileUpload = true)` and `isSingleFileUpload()` can be used to set and check if only one file can be uploaded.
537
+
538
+
Example:
539
+
540
+
```php
541
+
FileProcessorFormField::create('exampleFileID')
542
+
->objectType('foo.bar.example')
543
+
->label('foo.bar.example.title')
544
+
->singleFileUpload()
545
+
->bigPreview()
546
+
```
547
+
548
+
#### Additional Buttons
549
+
550
+
Additional buttons can be added with `addActionButton(string $actionName, string $title, string $template, string $application = 'wcf', ?IFontAwesomeIcon $icon = null)`.
551
+
When this button is pressed, the `fileProcessorCustomAction` event is fired, which can be used via JavaScript to perform additional actions.
0 commit comments