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
Fix locale leaking into tokens
Before
I'm trying to convert some code that uses our own message template stuff to call the core
CRM_Core_BAO_MessageTemplate::render()
function - while this isn't an api we don't have an equivalent at the moment & as our code is heavily tested I feel OK taking the risk calling it from outside of core. (Whether I can figure out the parameters is TBD)However, what I'm finding is that I have
When the name is NOT provided the call to
pathGet
is using the default it is passed .... the locale - so I wind up with 'Dear en_US'After
I get Dear as I would expect when first_name is not provided
Technical Details
I'm still deep in the struggling part of this bit of work so I struggle to articulate much but looking at the function signature of pathGet I can't see any reason why the locale rather than an empty string would be passed. I suspect NULL is OK too - but I'm scared to use NULL within token code code it has a history of breaking things
Comments
@totten