From: Aidan Saunders Date: Wed, 31 Oct 2018 18:15:53 +0000 (+0000) Subject: Add 'schema' to \Civi\Token\TokenProcessor() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=37f3765128bd2f8cdeee25b389756a20a91199e4;p=civicrm-core.git Add 'schema' to \Civi\Token\TokenProcessor() --- diff --git a/Civi/Token/TokenProcessor.php b/Civi/Token/TokenProcessor.php index bfad77926c..06e8b6cd0f 100644 --- a/Civi/Token/TokenProcessor.php +++ b/Civi/Token/TokenProcessor.php @@ -25,6 +25,10 @@ class TokenProcessor { * automatically from contactId.) * - actionSchedule: DAO, the rule which triggered the mailing * [for CRM_Core_BAO_ActionScheduler]. + * - schema: array, a list of fields that will be provided for each row. + * This is automatically populated with any general context + * keys, but you may need to add extra keys for token-row data. + * ex: ['contactId', 'activityId']. */ public $context; @@ -75,6 +79,9 @@ class TokenProcessor { * @param array $context */ public function __construct($dispatcher, $context) { + $context['schema'] = isset($context['schema']) + ? array_unique(array_merge($context['schema'], array_keys($context))) + : array_keys($context); $this->dispatcher = $dispatcher; $this->context = $context; }