dev/core#2814 Fix profile edit to use messagetemplate:render #21364
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
dev/core#2814 Fix profile edit to use messagetemplate:render
Before
Weird & wonderful way of resolving the tokens, no test
After
Test, uses
renderTemplate
Technical Details
If the api were merged I would have used that - but this adds the test & when can test converting
to the api when it is merged. It gets the hard lifting of this conversion out of the way
As of a 6 months ago, or so, we had resolved all differences between using the token processor and replaceContactTokens to ....replaceContactTokens.
We don't quite have the api yet but when complete it is pretty much a drop in replacement for
renderTemplate
Calling renderTemplate directly is supported provided
We don't have that many places left so I'm going to push through & replace them.
The last place in core is the token processor itself. I intend to cut that dependency last & duplicate the code in some way onto the processor.
While not supported from outside of core replaceContactTokens IS called from a number of places. We are also firming up the new token api so I don't want to 'hustle' people to change their code until it's bedded in so I propose to deprecate quietly at this stage (@deprecated on the function but don't make it 'noisy' for a few more months)
Comments
https://lab.civicrm.org/dev/core/-/issues/2814