diff --git a/CRM/Core/TokenTrait.php b/CRM/Core/TokenTrait.php index bb236232decd..2f995b432669 100644 --- a/CRM/Core/TokenTrait.php +++ b/CRM/Core/TokenTrait.php @@ -84,7 +84,10 @@ public function getReturnFields(): array { */ protected function getCustomFieldTokens(): array { if (!isset($this->customFieldTokens)) { - $this->customFieldTokens = \CRM_Utils_Token::getCustomFieldTokens(ucfirst($this->getEntityName())); + $this->customFieldTokens = []; + foreach (CRM_Core_BAO_CustomField::getFields(ucfirst($this->getEntityName())) as $id => $info) { + $this->customFieldTokens['custom_' . $id] = $info['label'] . ' :: ' . $info['groupTitle']; + } } return $this->customFieldTokens; } diff --git a/CRM/Utils/Token.php b/CRM/Utils/Token.php index 6e05a0d593fe..06dfc9d9bee6 100644 --- a/CRM/Utils/Token.php +++ b/CRM/Utils/Token.php @@ -1523,6 +1523,11 @@ public static function getUserTokenReplacement($token, $escapeSmarty = FALSE) { return $value; } + /** + * Do not use. + * + * @deprecated + */ protected static function _buildContributionTokens() { $key = 'contribution'; @@ -1544,6 +1549,10 @@ protected static function _buildContributionTokens() { } /** + * Do not use. + * + * @deprecated + * * Replace tokens for an entity. * @param string $entity * @param array $entityArray @@ -1856,6 +1865,8 @@ public static function legacyContactTokens() { /** * Get all custom field tokens of $entity * + * @deprecated + * * @param string $entity * @return array * return custom field tokens in array('custom_N' => 'label') format