| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC. All rights reserved. | |
| 6 | | | |
| 7 | | This work is published under the GNU AGPLv3 license with some | |
| 8 | | permitted exceptions and without any warranty. For full license | |
| 9 | | and copyright information, see https://civicrm.org/licensing | |
| 10 | +--------------------------------------------------------------------+ |
| 11 | */ |
| 12 | |
| 13 | /** |
| 14 | * Class CRM_Contribute_Tokens |
| 15 | * |
| 16 | * Generate "contribution.*" tokens. |
| 17 | * |
| 18 | * At time of writing, we don't have any particularly special tokens -- we just |
| 19 | * do some basic formatting based on the corresponding DB field. |
| 20 | */ |
| 21 | class CRM_Contribute_Tokens extends CRM_Core_EntityTokens { |
| 22 | |
| 23 | /** |
| 24 | * @return string |
| 25 | */ |
| 26 | protected function getEntityAlias(): string { |
| 27 | return 'contrib_'; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Get the entity name for api v4 calls. |
| 32 | * |
| 33 | * In practice this IS just ucfirst($this->GetEntityName) |
| 34 | * but declaring it seems more legible. |
| 35 | * |
| 36 | * @return string |
| 37 | */ |
| 38 | protected function getApiEntityName(): string { |
| 39 | return 'Contribution'; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * @return array |
| 44 | */ |
| 45 | public function getCurrencyFieldName() { |
| 46 | return ['currency']; |
| 47 | } |
| 48 | |
| 49 | } |