Merge pull request #23939 from civicrm/5.51
[civicrm-core.git] / CRM / Core / BAO / OptionValue.php
index 0214ca3072b40739f0b1a2eca32dc873433c2e2f..bb49356d77b4accb56d544633f382e5ed6e2d82f 100644 (file)
@@ -155,6 +155,9 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
       $params['option_group_id'], 'name', 'id'
     );
 
+    $op = $id ? 'edit' : 'create';
+    CRM_Utils_Hook::pre($op, 'OptionValue', $id, $params);
+
     // action is taken depending upon the mode
     $optionValue = new CRM_Core_DAO_OptionValue();
     $optionValue->copyValues($params);
@@ -218,6 +221,8 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
     $optionValue->save();
     CRM_Core_PseudoConstant::flush();
 
+    CRM_Utils_Hook::post($op, 'OptionValue', $id, $optionValue);
+
     // Create relationship for payment instrument options
     if (!empty($params['financial_account_id'])) {
       $optionName = civicrm_api3('OptionGroup', 'getvalue', [