Problem / Motivation

The current hook_field_widget_complete_form_alter() implementation contains a hardcoded switch over a fixed set of field types (entity_reference, entity_reference_revisions, color_field_type, default). Adding support for a new field type or letting other modules contribute their own handling requires patching this module.

Issues with the current architecture:

  • No extension point for contrib/custom modules.
  • The "default" case mixes simple replacement with composite (||-separated) handling in one branch.
  • Procedural helpers are not testable in isolation and leak from the module namespace.

Proposed resolution

Introduce a FieldLabelAlterer plugin type so per-field-type behaviour lives in dedicated plugin classes. The procedural hook becomes a thin dispatcher to the plugin manager.

Comments

nikita_tt created an issue. See original summary.

nikita_tt’s picture

Issue summary: View changes
jannakha’s picture

Version: 2.x-dev » 3.x-dev

Hi @nikita_tt!
Great module! Let's make v3.x happen - let me know if you need help with testing