Relate files to webform submissions that have fields pointing to file

Created on 27 September 2022, over 2 years ago
Updated 15 June 2023, almost 2 years ago

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

✨ Feature request
Status

Active

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States fskreuz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Can you get it to work in the other direction? Does it work for you if you create a view of the webform submissions, then add the File as a relationship through the file field?

    I'm trying to create a Bulk operation to download the files, and I haven't gotten it figured out yet.

  • I just figured out how to do what I'm looking to do, at least, the way I did it in D7.

    I create a view on File entity, then filter by URI, using URI - starts with:

    private://webform/WEBFORM_ID/
    

    Configure the webform module to save files like that, according to the webform ID.

Production build 0.71.5 2024