Problem/Motivation
Be able to relate a view of files to the submissions where the file was uploaded.
Use case: I have a webform with file fields (both regular file fields and file fields under a composite field). I'm using Page Manager + Views blocks to render submission data as layouted pages. Several of the blocks are lists of files attached to the submission.
The lists need to be views (and not hardcoded table renders of the file field) because I need to:
- Render additional data about the file on the row (the file name, the uploader because the submission can be edited, upload date, etc.)
- Render submission data (created, updated, completed) and some of the form fields.
- Render fields of the node the submission was submitted to (the name of a program, taxonomies)
Currently, there is no way to tie files to the webform submission it's attached to.
Steps to reproduce
1. Create a webform with a file field and a composite field with a file field.
2. Create several submissions using the form in Step 1.
3. Create a view of files.
4. Attempt to relate webform submissions the file was uploaded on.
On Step 4, there is no way to do such thing.
Proposed resolution
An additional relationship option when adding a relationship to file views.
Off the top of my head, something like:
- Join file_managed.fid and webform_submission_data.value only for file fields/composite file fields.
- Use the existing webform_views fields if possible, i.e. if I relate webform submissions to the file view, I should be able to use the same webform_views fields like when creating a view of webform submissions (no duplicate fields for this purpose).
Remaining tasks
- Patch
- Review
- Merge
User interface changes
- An additional relationship option when adding a relationship to file views.
API changes
None
Data model changes
None