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 configuration
  • Add 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 entity
  • Update \Drupal\webform\Plugin\EntityReferenceSelection\WebformSelection to exclude archived
  • Add archived message to \Drupal\webform\WebformSubmissionForm::getCustomForm
  • Add \Drupal\webform\WebformMessageManagerInterface::ADMIN_ARCHIVED constant
  • Update ::isOpen to return false when webform is archived.
  • Create tests/modules/webform_test/config/install/webform.webform.test_archived.yml
  • Update exported settings
  • Write tests
  • Write change record
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ericyellin created an issue. See original summary.

jrockowitz’s picture

Excluding 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.

jrockowitz’s picture

...or should we add the ability to archive a webform and all its submissions.

willcanderson’s picture

I'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.

lomale@bluewin.ch’s picture

Version: 8.x-5.0-beta25 » 8.x-5.0-rc3
Issue tags: +archive, +submissions

Hey 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

jrockowitz’s picture

Issue summary: View changes
jrockowitz’s picture

Issue summary: View changes
jrockowitz’s picture

Issue summary: View changes
jrockowitz’s picture

Issue summary: View changes

  • jrockowitz committed db43bbb on 2932893-archive
    Issue #2932893: Filter out closed forms in webform field
    
jrockowitz’s picture

Status: Active » Needs review
FileSize
20.4 KB

Doing a quick testbot review without any new test coverage.

This patch is NOT ready for any manual review.

  • jrockowitz committed 82fb3a1 on 2932893-archive
    Issue #2932893: Filter out closed forms in webform field. Remove archive...

  • jrockowitz committed 6881c1d on 2932893-archive
    Issue #2932893: Filter out closed forms in webform field. Restore...

  • jrockowitz committed 976d30e on 2932893-archive
    Issue #2932893: Filter out closed forms in webform field. Restore...

  • jrockowitz committed 0a358e4 on 2932893-archive
    Issue #2932893 by jrockowitz: Filter out closed forms in webform field.
    

  • jrockowitz committed a297411 on 2932893-archive
    Issue #2932893 by jrockowitz: Filter out closed forms in webform field.
    

  • jrockowitz committed 05104ad on 2932893-archive
    Issue #2932893 by jrockowitz: Filter out closed forms in webform field....

  • jrockowitz committed e7ed68a on 2932893-archive
    Issue #2932893 by jrockowitz: Filter out closed forms in webform field....

  • jrockowitz committed d378573 on 2932893-archive
    Issue #2932893 by jrockowitz: Filter out closed forms in webform field....

  • jrockowitz committed f171eef on 2932893-archive
    Issue #2932893 by jrockowitz: Filter out closed forms in webform field....
jrockowitz’s picture

Issue summary: View changes
FileSize
153.42 KB
jrockowitz’s picture

Issue summary: View changes
FileSize
152.88 KB

The attached patch is ready for review.

jrockowitz’s picture

Here is hopefully the final patch

  • jrockowitz committed 71d16a9 on 8.x-5.x
    Issue #2932893 by jrockowitz: Filter out closed forms in webform field
    
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.