Issue #3483: parent_id not always available as index
[civicrm-core.git] / CRM / Contribute / Tokens.php
index ca1b952cc7fb842cfc24209b783d14d6f0c90d87..6569c6a72ee34146048117db326b0e4ba7be8f54 100644 (file)
  */
 class CRM_Contribute_Tokens extends CRM_Core_EntityTokens {
 
-  /**
-   * @return string
-   */
-  protected function getEntityName(): string {
-    return 'contribution';
-  }
-
   /**
    * @return string
    */
@@ -47,61 +40,10 @@ class CRM_Contribute_Tokens extends CRM_Core_EntityTokens {
   }
 
   /**
-   * Get a list of tokens for the entity for which access is permitted to.
-   *
-   * This list is historical and we need to question whether we
-   * should filter out any fields (other than those fields, like api_key
-   * on the contact entity) with permissions defined.
-   *
    * @return array
    */
-  protected function getExposedFields(): array {
-    $fields = [
-      'contribution_page_id',
-      'source',
-      'id',
-      'receive_date',
-      'total_amount',
-      'fee_amount',
-      'net_amount',
-      'non_deductible_amount',
-      'trxn_id',
-      'invoice_id',
-      'currency',
-      'cancel_date',
-      'receipt_date',
-      'thankyou_date',
-      'tax_amount',
-      'contribution_status_id',
-      'financial_type_id',
-      'payment_instrument_id',
-      'cancel_reason',
-      'amount_level',
-      'check_number',
-    ];
-    if (CRM_Campaign_BAO_Campaign::isCampaignEnable()) {
-      $fields[] = 'campaign_id';
-    }
-    return $fields;
-  }
-
-  /**
-   * Get tokens supporting the syntax we are migrating to.
-   *
-   * In general these are tokens that were not previously supported
-   * so we can add them in the preferred way or that we have
-   * undertaken some, as yet to be written, db update.
-   *
-   * See https://lab.civicrm.org/dev/core/-/issues/2650
-   *
-   * @return string[]
-   */
-  public function getBasicTokens(): array {
-    $return = [];
-    foreach ($this->getExposedFields() as $fieldName) {
-      $return[$fieldName] = $this->getFieldMetadata()[$fieldName]['title'];
-    }
-    return $return;
+  public function getCurrencyFieldName() {
+    return ['currency'];
   }
 
 }