Add survey tokens
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 25 Jun 2023 19:41:35 +0000 (12:41 -0700)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sun, 25 Jun 2023 19:41:35 +0000 (12:41 -0700)
CRM/Campaign/SurveyTokens.php [new file with mode: 0644]
Civi/Core/Container.php

diff --git a/CRM/Campaign/SurveyTokens.php b/CRM/Campaign/SurveyTokens.php
new file mode 100644 (file)
index 0000000..96e9543
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved.                        |
+ |                                                                    |
+ | This work is published under the GNU AGPLv3 license with some      |
+ | permitted exceptions and without any warranty. For full license    |
+ | and copyright information, see https://civicrm.org/licensing       |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+
+/**
+ * Generate "survey.*" tokens.
+ *
+ * @noinspection PhpUnused
+ */
+class CRM_Campaign_SurveyTokens extends CRM_Core_EntityTokens {
+
+  /**
+   * Get the entity name for api v4 calls.
+   *
+   * @return string
+   */
+  protected function getApiEntityName(): string {
+    return 'Survey';
+  }
+
+}
index a4fb4aa275d2223832c54cc97b0335abedad07b1..14841c7f22c91a56998d9d39683310229af1dd7f 100644 (file)
@@ -364,6 +364,14 @@ class Container {
       'CRM_Contribute_RecurTokens',
       []
     ))->addTag('kernel.event_subscriber')->setPublic(TRUE);
+    $container->setDefinition('crm_contribution_recur_tokens', new Definition(
+      'CRM_Contribute_RecurTokens',
+      []
+    ))->addTag('kernel.event_subscriber')->setPublic(TRUE);
+    $container->setDefinition('crm_survey_tokens', new Definition(
+      'CRM_Campaign_SurveyTokens',
+      []
+    ))->addTag('kernel.event_subscriber')->setPublic(TRUE);
     $container->setDefinition('crm_group_tokens', new Definition(
       'CRM_Core_GroupTokens',
       []