Settings definitions allows for a field "on_change". Can anyone explain how to use this? I would like to have it execute a function that I have defined in my extension when my quickform is saved.


Documentation Referenced: https://docs.civicrm.org/dev/en/latest/framework/setting/#settings-definition

1 Answer 1


on_change is executed when setting value is changed. You can either set it

 'on_change' => [
   ['CLASS_NAME', 'functionName'],


'on_change' => [

A good example would be https://github.com/civicrm/civicrm-core/blob/master/settings/Localization.setting.php#L145



  • Is there any way to pass values through this? Or do I need an API call in my function to get the new value for the setting?
    – Sleewok
    Aug 8, 2018 at 13:38
  • 1
    functionName($oldValue, $newValue, $metadata, $domainID) {} Aug 8, 2018 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.