Skip to content

Update hook_civicrm_fieldOptions with new mode

colemanw requested to merge colemanw/dev:hook_civicrm_fieldOptions into master

New mode added in https://github.com/civicrm/civicrm-core/pull/30986, which changes the $options from a flat array to a rich format including id, name, label, color, description, icon, etc.

These changes to the hook signature are (somewhat) backward compatible: any hook that added or unset options by key would be unaffected. Other hook implementations that try to access values as strings might have problems though.

But the staus-quo was pretty bad, all the different formats depending on context made the hook really difficult to implement and prone to bugs.

So IMO whatever BC breaks happen with this change are worth it in the long-run because the new signature is much easier to work with.

Edited by colemanw

Merge request reports