cache campaign type ids

This commit is contained in:
Marc Michalsky forumZFD 2021-02-04 17:23:10 +01:00
parent 4b9700da9f
commit cf6ed7344f
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
2 changed files with 26 additions and 17 deletions

View file

@ -27,11 +27,9 @@ function twinglecampaign_civicrm_postSave_civicrm_campaign($dao) {
$hook_campaign_id = $dao->id;
// Get campaign type id for TwingleProject
$twingle_project_campaign_type_id = civicrm_api3(
'OptionValue',
'get',
['sequential' => 1, 'name' => 'twingle_project']
)['values'][0]['value'];
$twingle_project_campaign_type_id =
ExtensionCache::getInstance()
->getCampaigns()['campaign_types']['twingle_project']['id'];
// If $dao is a TwingleProject campaign, synchronize it
if ($hook_campaign_type_id == $twingle_project_campaign_type_id) {