Skip to content
Snippets Groups Projects
Commit 0f53b07c authored by scardinius's avatar scardinius
Browse files

Alter urls placed in footer or header

parent d17a6f24
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,15 @@ It's possible to use variables in [Smarty](http://www.smarty.net) format.
## UTM in footer
This feature works based on not published hook `hook_civicrm_alterUrl`, yet.
This feature works based on `hook_civicrm_alterMailContent`. There is needed a small patch to civicrm-core in order to have mailing_id and campaign_id visible by utmaltor.
```php
// todo add these lines in body of CRM_Mailing_BAO_Mailing::getTemplates() function
+ $this->templates['mailing_id'] = $this->id;
+ $this->templates['campaign_id'] = $this->campaign_id;
CRM_Utils_Hook::alterMailContent($this->templates);
```
Required configuration for CKEditor:
......
......@@ -113,12 +113,22 @@ function utmaltor_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
_utmaltor_civix_civicrm_alterSettingsFolders($metaDataFolders);
}
/**
* Implements hook_civicrm_alterMailContent().
*/
function utmaltor_civicrm_alterMailContent(&$content) {
// fixme mailing_id and campaign_id is added via patch to civicrm-core
$utmParams = ['mailing_id' => $content['mailing_id'], 'campaign_id' => $content['campaign_id'], 'subject' => $content['subject']];
$content['html'] = _utmaltor_findUrls($content['html'], $utmParams);
$content['text'] = _utmaltor_findUrls($content['text'], $utmParams);
}
/**
* Implements hook_civicrm_container().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_container
*/
function utmaltor_civicrm_container($container) {
function utmaltor_civicrm_container(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
// Add a Symfony listener on civi.flexmailer.run. See Flexmailer dev docs for details.
$container->addResource(new \Symfony\Component\Config\Resource\FileResource(__FILE__));
$container->findDefinition('dispatcher')->addMethodCall('addListener',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment