From 37f3765128bd2f8cdeee25b389756a20a91199e4 Mon Sep 17 00:00:00 2001 From: Aidan Saunders Date: Wed, 31 Oct 2018 18:15:53 +0000 Subject: [PATCH] Add 'schema' to \Civi\Token\TokenProcessor() --- Civi/Token/TokenProcessor.php | 7 +++++++ 1 file changed, 7 insertions(+) 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; } -- 2.25.1