Merge pull request #20251 from larssandergreen/change-registration-button-text
[civicrm-core.git] / CRM / Contribute / WorkflowMessage / ContributionTrait.php
CommitLineData
66c8a610
EM
1<?php
2
3/**
4 * @method array getContribution()
2a402daa
TO
5 * @method ?int getContributionID()
6 * @method $this setContributionID(?int $contributionId)
66c8a610
EM
7 */
8trait CRM_Contribute_WorkflowMessage_ContributionTrait {
9 /**
10 * The contribution.
11 *
12 * @var array|null
13 *
14 * @scope tokenContext as contribution
15 */
16 public $contribution;
17
18 /**
19 * @var int
20 * @scope tokenContext as contribution_id
21 */
22 public $contributionId;
23
6b892bd2
EM
24 /**
25 * Is the site configured such that tax should be displayed.
26 *
27 * @var bool
28 */
29 public $isShowTax;
30
66c8a610
EM
31 /**
32 * Set contribution object.
33 *
34 * @param array $contribution
35 *
36 * @return $this
37 */
38 public function setContribution(array $contribution): self {
39 $this->contribution = $contribution;
40 if (!empty($contribution['id'])) {
41 $this->contributionId = $contribution['id'];
42 }
43 return $this;
44 }
45
6b892bd2
EM
46 /**
47 * Extra variables to be exported to smarty based on being calculated.
48 *
49 * We export isShowTax to denote whether invoicing is enabled but
50 * hopefully at some point we will separate the assumption that invoicing
51 * and tax are a package.
52 *
53 * @param array $export
54 */
55 protected function exportExtraTplParams(array &$export): void {
56 $export['isShowTax'] = (bool) Civi::settings()->get('invoicing');
57 }
58
66c8a610 59}