Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem
Looking for a way to display only open forms or only forms from a specific category when using the webform field option in a node.
When you start having dozens of forms, not having to sift through closed and non-relevant ones when adding a form to a node, would be great.
Solution
Add the ability to archive a webform and all its submissions.
Notes
- Archived webforms are automatically closed.
- Archived webforms will be removed from all filters and autocompletes
- Archived webforms will only be accessible from 'Filter webforms' (/admin/structure/webform)
- The MVP is just being able to archive a webform and have it hidden from the general UX
Questions/TDB
- Should only webform adminstrators be able to access archived webforms?
- Should all configuration and form building UI's be disabled for archived webforms?
Tasks
Add archive (boolean) to Webform configurationAdd archive checkbox to Webform general settings(/admin/structure/webform/manage/contact/settings)Add archive to Webforms status column(/admin/structure/webform)Add archive to 'Filter webforms'(/admin/structure/webform)Handle archived webforms in 'Filter webforms' autocomplete.(\Drupal\webform\Controller\WebformEntityController::autocomplete)Add Webform::isArchived to Webform entityUpdate \Drupal\webform\Plugin\EntityReferenceSelection\WebformSelection to exclude archivedAdd archived message to \Drupal\webform\WebformSubmissionForm::getCustomFormAdd \Drupal\webform\WebformMessageManagerInterface::ADMIN_ARCHIVED constantUpdate ::isOpen to return false when webform is archived.Create tests/modules/webform_test/config/install/webform.webform.test_archived.ymlUpdate exported settingsWrite testsWrite change record
Comment | File | Size | Author |
---|---|---|---|
#23 | 2932893-23.patch | 152.71 KB | jrockowitz |
| |||
#22 | 2932893-22.patch | 152.88 KB | jrockowitz |
| |||
#21 | 2932893-21.patch | 153.42 KB | jrockowitz |
| |||
#11 | 2932893-11.patch | 20.4 KB | jrockowitz |
|
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedExcluding closed forms makes sense to me.
Categories are stored as strings of text which are translatable which means there is no unique or stable id to filter by.
Letting people select/check which webforms can be referenced might be a little too extreme. I am open to other peoples opinion.
Comment #3
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented...or should we add the ability to archive a webform and all its submissions.
Comment #4
willcanderson CreditAttribution: willcanderson commentedI'm at a school that uses webforms heavily, and I would love the ability to "select/check which webforms can be referenced" even if that means a lot of manual setup. Of course, I'd also be thrilled with a more automated solution. Here's my use case:
My school uses webforms for many different purposes: requests for admissions materials, alumni surveys, class registration, student government elections, etc, but by far the most common is event RSVPs. We have Event nodes, and I would love it if editors could use a webform field to select either "Basic RSVP" or "Alumni RSVP" or "Student RSVP" to get one of those forms right on the event page. However, there are two problems:
- Usability: We have far too many forms for people be able to find an appropriate choice. In our case, it would be something like three out of 300.
- Permissions: Anyone in our community can create an event node, but not everybody should be able to attach any type of form to that node. E.g., students should be able to use our RSVP form on their event node, but not our admissions form.
Comment #5
lomale@bluewin.ch CreditAttribution: lomale@bluewin.ch as a volunteer and commentedHey that's what I'm using to. so far I have made a filter option. archived webforms.
We have meetings, general assemblies and trainings.
so I store all the forms with all the submissions to have a follow up of all the participants.
this : "add the ability to archive a webform and all its submissions" would be a great feature more.
Thanks Jake
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedDoing a quick testbot review without any new test coverage.
This patch is NOT ready for any manual review.
Comment #21
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #22
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe attached patch is ready for review.
Comment #23
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedHere is hopefully the final patch
Comment #25
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download the latest dev release to review.