Skip to content

Commit

Permalink
Merge pull request #27063 from eileenmcnaughton/context
Browse files Browse the repository at this point in the history
Do the todo (move the function to the trait as suggested
  • Loading branch information
totten authored Aug 13, 2023
2 parents 7375330 + c5b3941 commit 0d130f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 0 additions & 12 deletions CRM/Contribute/WorkflowMessage/ContributionInvoiceReceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,4 @@ class CRM_Contribute_WorkflowMessage_ContributionInvoiceReceipt extends GenericW

public const WORKFLOW = 'contribution_invoice_receipt';

/**
* Specify any tokens that should be exported as smarty variables.
*
* @todo it might be that this should be moved to the trait as we
* we work through these.
*
* @param array $export
*/
protected function exportExtraTokenContext(array &$export): void {
$export['smartyTokenAlias']['currency'] = 'contribution.currency';
}

}
10 changes: 10 additions & 0 deletions CRM/Contribute/WorkflowMessage/ContributionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,14 @@ protected function exportExtraTplParams(array &$export): void {
$export['isShowTax'] = (bool) Civi::settings()->get('invoicing');
}

/**
* Specify any tokens that should be exported as smarty variables.
*
* @param array $export
*/
protected function exportExtraTokenContext(array &$export): void {
$export['smartyTokenAlias']['currency'] = 'contribution.currency';
$export['smartyTokenAlias']['taxTerm'] = 'domain.tax_term';
}

}
2 changes: 2 additions & 0 deletions Civi/WorkflowMessage/GenericWorkflowMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ protected function validateExtra_contact(array &$errors) {
protected function exportExtraTokenContext(array &$export): void {
// Tax term is exposed at the generic level as so many templates use it
// (e.g. Membership, participant, pledge as well as contributions).
// However, these basically now all implement the ContributionTrait so we
// can hopefully remove from here (after some checking).
$export['smartyTokenAlias']['taxTerm'] = 'domain.tax_term';
}

Expand Down

0 comments on commit 0d130f9

Please sign in to comment.