- if (in_array($field, ['start_date', 'end_date', 'join_date'])) {
- $row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->$field));
- }
- elseif ($field == 'fee') {
- $row->tokens($entity, $field, \CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency($actionSearchResult->$field));
- }
- elseif (isset($actionSearchResult->$field)) {
- $row->tokens($entity, $field, $actionSearchResult->$field);
- }
- elseif ($cfID = \CRM_Core_BAO_CustomField::getKeyID($field)) {
- $row->customToken($entity, $cfID, $actionSearchResult->entity_id);
- }
- else {
- parent::evaluateToken($row, $entity, $field, $prefetch);
- }
+ /**
+ * Get any tokens with custom calculation.
+ *
+ * In this case 'fee' should be converted to{membership.membership_type_id.fee}
+ * but we don't have the formatting support to do that with no
+ * custom intervention yet.
+ */
+ protected function getBespokeTokens(): array {
+ return [
+ 'fee' => [
+ 'title' => ts('Membership Fee'),
+ 'name' => 'fee',
+ 'type' => 'calculated',
+ 'options' => NULL,
+ 'data_type' => 'integer',
+ 'audience' => 'user',
+ ],
+ ];