MessageTemplate - Deprecate valueName
. Emphasize workflow
. Consolidate converters.
#21657
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
CRM_Core_BAO_MessageTemplate::sendTemplate()
and::renderTemplate()
accept an argument calledvalueName
. The the option has grown misleading -- if message templates will no longer be identified byOptionValue
per se. Of course, the content is still important as it identifies the workflow step (a lacivicrm_msg_template.workflow_name
WorkflowMessage::WORKFLOW
).The primary change of this branch is to deprecate
valueName
in favor ofworkflow
. Additionally, it does some cleanup for other fields that went through a similar change.Before
contactId
anddisableSmarty
are translated totokenContext.contactId
andtokenContext.smarty
. However, these translations are sprinkled around.sendTemplate()
andrenderTemplate()
usevalueName
WorkflowMessage
andhook_alterMailParams
use the same params as ^^ -- so they usevalueName
After
valueName
,contactId
, anddisableSmarty
all work the same way - and they've each been boiled down to 1-line call (CRM_Utils_Array::pathSync()
)sendTemplate()
andrenderTemplate()
useworkflow
(with alias support forvalueName
)WorkflowMessage
andhook_alterMailParams
use the same params as ^^ -- so they useworkflow
(with alias support forvalueName
)Comments
It's tempting to add an extra warning at the start of
renderTemplateRaw()
, although this would make the patch a longer (ie we'll get test-failures for old callers - and need to update each).