Closed (fixed)
Project:
Custom Field
Version:
3.1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
21 Jun 2025 at 16:47 UTC
Updated:
10 Jul 2025 at 06:04 UTC
Jump to comment: Most recent
We can reduce code in various widgets by passing down the form array parents structure as a property on the element. This can be used for unique name keys for ajax buttons, limit_validation_errors, wrapper ids, etc...
In CustomFieldWidgetBase, add the logic for:
$parents = $form['#parents'];
$field_parents = array_merge($parents, [$field_name, $delta, $field->getName()]);And then set it as a property value on the element:
'#field_properties' => $field_parents
Audit widgets where this can be adopted and reduce unnecessary code.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
apmsooner commentedComment #5
apmsooner commentedComment #6
apmsooner commented