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

CRM-21020 add context details to alterMailContent hook #10815

Merged
merged 1 commit into from
Dec 29, 2017

Conversation

lcdservices
Copy link
Contributor

@lcdservices lcdservices commented Aug 3, 2017

Overview

The alterMailContent hook can be used to alter templates and email content before token processing occurs. Currently it only passes the subject, html, and text content to the hook, which means you have very little context to work with.

When this is triggered via msg template generation, include details about the template so the hook implementation can be conditioned meaningfully.

Technical Details

Includes template groupName, valueName, messageTemplateID when the hook is called from the message template context.


@monishdeb
Copy link
Member

@@ -406,6 +406,9 @@ public static function sendTemplate($params) {
'text' => $dao->text,
'html' => $dao->html,
'format' => $dao->format,
'groupName' => $params['groupName'],
'valueName' => $params['valueName'],
'messageTemplateID' => $params['messageTemplateID'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point the $params will always have these 3 information as there is a check at L365 above.

@monishdeb monishdeb merged commit 0672b93 into civicrm:master Dec 29, 2017
@seamuslee001
Copy link
Contributor

@lcdservices Brian thanks for this are you able to make a PR against the developer Docs to update the documentation about the hook?

@monishdeb
Copy link
Member

monishdeb commented Dec 29, 2017

I had a thought about this, which I found that there is already a doc on this hook but need to change the description under 'Details' to:

Details:
$content - fields include: html, text, subject, groupName, valueName and messageTemplateID

Also if we can add an example?

@lcdservices
Copy link
Contributor Author

here's the doc PR:
civicrm/civicrm-dev-docs#466

sluc23 pushed a commit to ixiam/civicrm-core that referenced this pull request Jan 10, 2018
CRM-21020 add context details to alterMailContent hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants