Improve Webform categorization to support assigning multiple categories and default categories.

Created on 7 February 2023, over 2 years ago
Updated 16 February 2024, over 1 year ago

Problem/Motivation

As a form builder, I would like to apply multiple categories to webforms so that I can filter by a webform based of different categories. For example, a webform could be used for event registration with a payment. Currently, the webform can only be categorized as 'Event' or 'Payment'

It is also important to note that a webform's category is stored as a simple string, making it difficult to translate. No one has complained about this limitation because I think most websites manage webforms using the site's default language.

Steps to reproduce

Assign a webform to a category.

Notes

  • Webform categories are stored as strings.
  • Webform category must be assigned to webform for it to appear in the webform category dropdown.
  • Webform categories are pulled from all webforms. This creates a performance issue that requires all webforms to be loaded and cached.. @see #3239783: Cache webform categories β†’

Proposed resolution

Support multiple categories.

Below are three potential approaches.

APPROACH 1:

Update webform category to support multiple values.

Pro: Simplest solution

Cons: Makes it difficult to create multiple custom categories because the select other element only supports one category

APPROACH 2:

Improve the overall management of webform categories and add default categories to webform.settings.yml

Pro: Allows only webform administrators to create default webform categories while allowing form builders to create custom categories.

Cons: Performance issue potential still exist. Translations may still be an issue.

APPROACH 3:

Move webform categorization to use a dedicated 'webform_categories' taxonomy.

Pro: Taxonomies are intended for categorization and are easier to translate.

Cons: Moving simple configuration settings to a taxonomy (aka content entity) will make it difficult to move webform categories across multiple webform sites. Add additional complexity,

Remaining tasks

  • Determine approach
  • Build approach
  • Write tests
  • Commit code

User interface changes

Selecting a webform category will support multiple values.

API changes

Webform category setting will support multiple categories.

Data model changes

Webform category supports multiple categories

✨ Feature request
Status

Fixed

Version

6.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

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

Comments & Activities

Production build 0.71.5 2024