Duplicate default element callbacks

Created on 10 May 2022, over 3 years ago
Updated 20 August 2025, about 1 month ago

Problem/Motivation

The WebformElementBase::setElementDefaultCallback() method doesn't take already added callbacks into account, which leads to duplicate callback.

I needed to add a #process callback to a checkboxes element, but since it was also important that my callback was the first one, I also added the default callbacks after it. Result: the default callbacks are executed twice, once before and once after my callback.

Steps to reproduce

Add a custom and the default #process callbacks to an element with the options__properties propery. The default callbacks are added again by WebformElementBase::setElementDefaultCallback().

Proposed resolution

Don't add the default callbacks if at least one (you may want to remove some) of them is already present.

πŸ› Bug report
Status

Needs review

Version

6.3

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium matthijs

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024