Skip to content

Commit

Permalink
Merge pull request #21465 from eileenmcnaughton/cont_tok
Browse files Browse the repository at this point in the history
[Ref] Cleanup on SelectValues::contributeTokens
  • Loading branch information
colemanw authored Sep 14, 2021
2 parents 6fe7443 + 1ee5621 commit dd77834
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CRM/Core/EntityTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ public function getReturnFields(): array {
* Get all the tokens supported by this processor.
*
* @return array|string[]
* @throws \API_Exception
*/
public function getAllTokens(): array {
protected function getAllTokens(): array {
$basicTokens = $this->getBasicTokens();
foreach (array_keys($basicTokens) as $fieldName) {
// The goal is to be able to render more complete tokens
Expand Down
10 changes: 3 additions & 7 deletions CRM/Core/SelectValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,17 +560,13 @@ public static function eventTokens() {
}

/**
* Different type of Event Tokens.
* Different type of Contribution Tokens.
*
* @return array
*/
public static function contributionTokens(): array {
$tokens = [];
$processor = new CRM_Contribute_Tokens();
foreach ($processor->getAllTokens() as $token => $title) {
$tokens['{contribution.' . $token . '}'] = $title;
}
return $tokens;
$tokenProcessor = new TokenProcessor(Civi::dispatcher(), ['schema' => ['contributionId']]);
return $tokenProcessor->listTokens();
}

/**
Expand Down

0 comments on commit dd77834

Please sign in to comment.