Merge pull request #24022 from colemanw/afformFrontend
[civicrm-core.git] / CRM / Core / TokenTrait.php
index bb236232decd31e12740059110b0b78f4c83c445..36c6829bb826b5239b60a6e4b27bb60ae8289b36 100644 (file)
@@ -46,12 +46,6 @@ trait CRM_Core_TokenTrait {
       if (array_key_exists($msgToken, $this->tokenNames)) {
         $activeTokens[] = $msgToken;
       }
-      else {
-        $altToken = preg_replace('/_\d+_/', '_N_', $msgToken);
-        if (array_key_exists($altToken, $this->tokenNames)) {
-          $activeTokens[] = $msgToken;
-        }
-      }
     }
     return array_unique($activeTokens);
   }
@@ -84,7 +78,10 @@ trait CRM_Core_TokenTrait {
    */
   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;
   }