Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate building of contact token list #21429

Merged
merged 2 commits into from
Sep 12, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Sep 10, 2021

Overview

Consolidate building of contact token list

Before

Code to derive a list of tokens for the TokenCompatProcessor was not available to TokenCompatProcessor - the actual processing has been almost entirely moved to the class (replaceGreetingTokens being a stand-out resister)

After

list of contact tokens now rendered from the class

Technical Details

  • Since there are no existing places this is called from I kept the isActive logic very simple - at least for now.

  • I'm double checking this - but it seemed to render Individual & contact tokens but not other subtypes

  • The generation of the list of tokens was derived through long and convuled code and did not map to the contact entity's fields since there are other entities involved - so I just hard-coded it. This has the advantage of allowing us to visually check in on it as we fix the other issues in this class.

Comments

I put up the test cover separately here #21427 to demonstrate it passes before this change too....

@civibot
Copy link

civibot bot commented Sep 10, 2021

(Standard links)

@civibot civibot bot added the master label Sep 10, 2021
@eileenmcnaughton eileenmcnaughton changed the title Extend test cover on token fields Consolidate building of contact token list Sep 10, 2021
Extends test cover to check advertised tokens for contacts and to check
those advertised in hooks are included
@eileenmcnaughton
Copy link
Contributor Author

I've just double checked & the custom field handling is the same - ie before and after you will see Individual and Contact custom field tokens in the widget, not organization

@seamuslee001 I think this should be mergeable now - it will make it easier to clean up the render part

@colemanw
Copy link
Member

Cleanup looks good and covered by tests.

@colemanw colemanw merged commit 8271744 into civicrm:master Sep 12, 2021
@colemanw colemanw deleted the tok_hook2 branch September 12, 2021 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants