Ga naar hoofdinhoud

CnFilesWidgetForm

Config sub-form for the files widget — folder, view mode, mime filter.

Part of the dashboard widget library (v2). Registered with the dashboard widget registry and consumed by LaunchPad's widget grid. See the widget library overview and docs/architecture/cards-and-widgets.md.

Choosing a folder​

The target folder is chosen with the native Nextcloud folder picker rather than typed by hand. A Browse… button opens getFilePickerBuilder (from @nextcloud/dialogs) restricted to directories (httpd/unix-directory, allowDirectories(true)), starting at the currently-configured path. On selection the picked node populates both folderPath and the backend-preferred numeric fileId, so the folder is guaranteed to exist and the reliable id is captured automatically — there is no free-text path or id field. Cancelling the picker is a no-op. Existing widgets that were saved with only a folderPath continue to work unchanged.

Object-bound pages (folder picker disabled)​

On a detail / object page, the rendered CnFilesWidget runs in object-bound mode — it lists and uploads files against the current object's OpenRegister folder, and the fixed folderPath is ignored (see cn-files-widget.md). The form detects this via the injected cnObjectContext ({ register, schema }, re-provided by CnAddWidgetModal from the page context): when present, the Browse… button is disabled, the path field reads "Current object", and a short note explains that the folder cannot be set there. On a dashboard (no object context) the picker behaves exactly as above.

Reference​

Props​

NameTypeRequiredDefaultDescription
editingWidget{content: object}|nullnullThe placement being edited, or null in create mode. Pre-fills every control from editingWidget.content.
valueobject\{ ...DEFAULT_CONTENT \}Initial content values — used when not editing and the parent supplies registry defaults.

Events​

NamePayloadDescription
update:content—Emitted with the assembled content blob on every field change.