From aafcc3ffcfcbc4ac3a86690a083de71a950ebcac Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Wed, 25 Oct 2023 23:06:49 +0100 Subject: [PATCH] test fixes --- ext/afform/core/Civi/Afform/Tokens.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/afform/core/Civi/Afform/Tokens.php b/ext/afform/core/Civi/Afform/Tokens.php index 093f1b02b0..c7b901f944 100644 --- a/ext/afform/core/Civi/Afform/Tokens.php +++ b/ext/afform/core/Civi/Afform/Tokens.php @@ -111,6 +111,11 @@ class Tokens extends AutoService implements EventSubscriberInterface { } public static function listTokens(\Civi\Token\Event\TokenRegisterEvent $e) { + // this tokens should be available only in contact context i.e. in Message Templates (add/edit) + if (!in_array('contactId', $e->getTokenProcessor()->getContextValues('schema')[0])) { + return; + } + $e->entity('afformSubmission') ->register('validateSubmissionUrl', E::ts('Validate Submission URL')) ->register('validateSubmissionLink', E::ts('Validate Submission (Full Hyperlink)')); -- 2.25.1