0

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.

THanks!

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

3

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

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

Else

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

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

HTH

Pradeep

  • 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 '18 at 13:38
  • 1
    functionName($oldValue, $newValue, $metadata, $domainID) {} – Pradeep Nayak Aug 8 '18 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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