Add a isCategory method to Webform entity

Created on 12 December 2023, 7 months ago
Updated 13 December 2023, 7 months ago

Problem/Motivation

As Webforms can have multiple categories now, it would be nice to have a quick method to check if a Webform belongs to a given category.

Steps to reproduce

Currently, have to use the $webform->get('categories') method and then check the array that is returned.

Proposed resolution

See included patch, which adds a $webform->isCategory($name) method where $name is the category name

Adds also a hasCategories() method to just check whether Webform is categorized at all

I have a question about whether the capitalization of the category name string should be standardized before doing the check...

✨ Feature request
Status

Closed: won't fix

Version

6.2

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada endless_wander

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

Comments & Activities

Production build 0.69.0 2024