Filtering by category doesn't work properly in webform templates tabs

Created on 17 November 2023, about 1 year ago
Updated 5 December 2023, about 1 year ago

Problem/Motivation

As a form builder, I would like it to work correctly when filtering by category, either by entering the category via text or with the 'Filter by Category' selector.

This is currently not possible, since if for example we have a template with category A the results dump is incorrect since they return results that do not match our filtering criteria, for example it may return more results than expected or there are even times that does not return any results with the message “There are no templates available.” knowing that we have a template with that category.

As a result of this problem that I am suffering, I have realized that starting with version 6.2.x a form can have multiple categories and I think that is the problem, since the field that was previously a category was changed to categories (obviously). Here is the issue related: https://www.drupal.org/project/webform/issues/3339769 Improve Webform categorization to support assigning multiple categories and default categories. Fixed

However, this is not reflected when filtering in the getTemplates() function of the WebformTemplatesController.php class (webform_templates module) since category is being used instead of categories

Also add that this happens for both tabs: List (/admin/structure/webform/templates) and Manage (/admin/structure/webform/templates/manage)

Steps to reproduce

This occurs on both tabs List (/admin/structure/webform/templates) and Manage (/admin/structure/webform/templates/manage).

Make sure you have forms with different categories.

After knowing that we have accomplished the above, we can perform the following steps:

  1. Go to any path, List or Manage (routes mentioned above)
  2. Try filtering results with a category that we have added to a form either by filtering by text or with the "Filter by category" selector, or even both.
  3. The results dump does not correspond to what was expected. It may return more results than expected or even none at all with the message "There are no templates available."

Proposed resolution

As a proposed resolution, I propose to adjust the getTemplates() function of the WebformTemplatesController.php class with the changes according to version 6.2.x

🐛 Bug report
Status

Fixed

Version

6.2

Component

Code

Created by

🇪🇸Spain cmarrufo

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024