add cid to TwingleCampaign.get and .getsingle specs
This commit is contained in:
parent
fa093e4b68
commit
47e7d2a668
2 changed files with 23 additions and 0 deletions
|
@ -19,6 +19,13 @@ function _civicrm_api3_twingle_campaign_Get_spec(array &$spec) {
|
||||||
'api.required' => 0,
|
'api.required' => 0,
|
||||||
'description' => E::ts('The Twingle Campaign ID'),
|
'description' => E::ts('The Twingle Campaign ID'),
|
||||||
];
|
];
|
||||||
|
$spec['cid'] = [
|
||||||
|
'name' => 'cid',
|
||||||
|
'title' => E::ts('Twingle Campaign CID'),
|
||||||
|
'type' => CRM_Utils_Type::T_STRING,
|
||||||
|
'api.required' => 0,
|
||||||
|
'description' => E::ts('A unique identifier for a TwingleCampaign generated by a hashing its id + name'),
|
||||||
|
];
|
||||||
$spec['project_id'] = [
|
$spec['project_id'] = [
|
||||||
'name' => 'project_id',
|
'name' => 'project_id',
|
||||||
'title' => E::ts('Parent Twingle Project ID'),
|
'title' => E::ts('Parent Twingle Project ID'),
|
||||||
|
@ -132,6 +139,14 @@ function civicrm_api3_twingle_campaign_Get(array $params): array {
|
||||||
// Include campaign type ot TwingleCampaigns in $params
|
// Include campaign type ot TwingleCampaigns in $params
|
||||||
$params['campaign_type_id'] = $twingle_campaign_campaign_type_id;
|
$params['campaign_type_id'] = $twingle_campaign_campaign_type_id;
|
||||||
|
|
||||||
|
// Translate cid custom field
|
||||||
|
if (array_key_exists('cid', $params) && !empty($params['cid'])) {
|
||||||
|
$cf_cid = Cache::getInstance()
|
||||||
|
->getCustomFieldMapping('twingle_campaign_cid');
|
||||||
|
$params[$cf_cid] = $params['cid'];
|
||||||
|
unset($params['cid']);
|
||||||
|
}
|
||||||
|
|
||||||
$campaigns = civicrm_api3('Campaign',
|
$campaigns = civicrm_api3('Campaign',
|
||||||
'get',
|
'get',
|
||||||
$params
|
$params
|
||||||
|
|
|
@ -17,6 +17,14 @@ function _civicrm_api3_twingle_campaign_Getsingle_spec(&$spec) {
|
||||||
'api.required' => 0,
|
'api.required' => 0,
|
||||||
'description' => E::ts('The Twingle Campaign ID'),
|
'description' => E::ts('The Twingle Campaign ID'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$spec['cid'] = [
|
||||||
|
'name' => 'cid',
|
||||||
|
'title' => E::ts('Twingle Campaign CID'),
|
||||||
|
'type' => CRM_Utils_Type::T_STRING,
|
||||||
|
'api.required' => 0,
|
||||||
|
'description' => E::ts('A unique identifier for a TwingleCampaign generated by a hashing its id + name'),
|
||||||
|
];
|
||||||
$spec['name'] = [
|
$spec['name'] = [
|
||||||
'name' => 'name',
|
'name' => 'name',
|
||||||
'title' => E::ts('Campaign Name'),
|
'title' => E::ts('Campaign Name'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue