Eliminate multiple calls to settings form validate handler

Created on 23 February 2022, almost 3 years ago

Problem/Motivation

The fieldSettingsFormValidate method is set as the element_validate handler on each instance of the targetTypeFieldSettingsForm (i.e. once for each target entity type). If there are N such types in play, then the validation handler is called N times. The validation handler does not process one type at a time but loops on the N types. Thus, the validation is done N times for each of the N types.

Steps to reproduce

Preparation: add debug output to fieldSettingsFormValidate using whatever method suits you.

Add a DER field to a content entity type.
Edit the field settings.
Save the form.

Inspect the debug output to confirm N calls to the validation handler.

Proposed resolution

Move the element_validate setting to the main setting form definition. See patch.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

RTBC

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States solotandem

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