This deprecates (quietly) another function on CRM_Utils_Token. It's a pretty small function -
the sort you'd just copy & paste if you wanted to use outside of core but
I didn't add noise. The only core place that calls this is the tokenTrait
- which is 'used' by activity tokens - but only for the handling of _N_
which I think was actually not supposed to have been included in the merge.
Anyway - I'm leaving that question for later because I'm not sure if the token
trait is used outside of core or how our final interface will look
*/
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;
}
}
/**
+ * Do not use.
+ *
+ * @deprecated
+ *
* Replace tokens for an entity.
* @param string $entity
* @param array $entityArray
/**
* Get all custom field tokens of $entity
*
+ * @deprecated
+ *
* @param string $entity
* @return array
* return custom field tokens in array('custom_N' => 'label') format