Add corresponding field and instance hooks of hook_field_widget_properties_alter().

Created on 23 January 2012, over 12 years ago
Updated 24 June 2023, about 1 year ago

There are a number of field and instance settings that can not be altered globally via hook_field_widget_properties_alter(). So this request is to enable contrib to alter values in the field and instance after field_attach_form() and before MODULE_field_widget_form().

The two use-cases that I am interested are in:

a) Alter the field cardinality from MAX to 1 to something less than or equal to MAX
b) Toggle the required flag [without knowledge of each and every widget that could potentially set it's own required validation function]

We need to control both of these based on the active domain (domain access). This is likely useful in some role based module too. The current solution is to blindly hope that setting #required works on the widget and skipping cardinality as handling this is too hard via form_alters().

Note that this overlaps Allow cardinality to be restricted (overriden and reduced) in the field instance settings Active .

Feature request
Status

Closed: duplicate

Version

9.5

Component
Field 

Last updated 1 day ago

Created by

🇦🇺Australia Alan D.

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