protected static function _buildContributionTokens() {
$key = 'contribution';
if (self::$_tokens[$key] == NULL) {
- self::$_tokens[$key] = array_keys(array_merge(CRM_Contribute_BAO_Contribution::exportableFields('All'),
- ['campaign', 'financial_type'],
+ $tokens = array_merge(CRM_Contribute_BAO_Contribution::exportableFields('All'),
+ ['campaign' => [], 'financial_type' => [], 'payment_instrument' => []],
self::getCustomFieldTokens('Contribution')
- ));
+ );
+ foreach ($tokens as $token) {
+ if (!empty($token['name'])) {
+ $tokens[$token['name']] = [];
+ }
+ }
+ self::$_tokens[$key] = array_keys($tokens);
}
}
//early return
return $str;
}
- self::_buildContributionTokens();
// here we intersect with the list of pre-configured valid tokens
// so that we remove anything we do not recognize
* @throws \CiviCRM_API3_Exception
*/
public function tearDown(): void {
+ CRM_Utils_Token::$_tokens['contribution'] = NULL;
$this->quickCleanUpFinancialEntities();
$this->quickCleanup(['civicrm_uf_match', 'civicrm_campaign'], TRUE);
CRM_Utils_Hook::singleton()->reset();