+ protected function getBespokeTokens(): array {
+ return [
+ 'balance' => [
+ 'title' => ts('Event Balance'),
+ 'name' => 'balance',
+ 'type' => 'calculated',
+ 'options' => NULL,
+ 'data_type' => 'Money',
+ 'audience' => 'user',
+ ],
+ ];
+ }
+
+ public function alterActionScheduleQuery(\Civi\ActionSchedule\Event\MailingQueryEvent $e): void {
+ // When targeting `civicrm_participant` records, we enable both `{participant.*}` (per usual) and the related `{event.*}`.
+ parent::alterActionScheduleQuery($e);
+ if ($e->mapping->getEntity() === $this->getExtendableTableName()) {
+ $e->query->select('e.event_id AS tokenContext_eventId');
+ }