Esempio n. 1
0
 /**
  * @param EmailBuilderEvent $event
  */
 public function onEmailBuild(EmailBuilderEvent $event)
 {
     if ($event->tokenSectionsRequested()) {
         //add email tokens
         $content = $this->templating->render('MauticEmailBundle:SubscribedEvents\\EmailToken:token.html.php');
         $event->addTokenSection('email.emailtokens', 'mautic.email.builder.index', $content);
     }
     if ($event->abTestWinnerCriteriaRequested()) {
         //add AB Test Winner Criteria
         $openRate = ['group' => 'mautic.email.stats', 'label' => 'mautic.email.abtest.criteria.open', 'callback' => '\\Mautic\\EmailBundle\\Helper\\AbTestHelper::determineOpenRateWinner'];
         $event->addAbTestWinnerCriteria('email.openrate', $openRate);
         $clickThrough = ['group' => 'mautic.email.stats', 'label' => 'mautic.email.abtest.criteria.clickthrough', 'callback' => '\\Mautic\\EmailBundle\\Helper\\AbTestHelper::determineClickthroughRateWinner'];
         $event->addAbTestWinnerCriteria('email.clickthrough', $clickThrough);
     }
     $tokens = ['{unsubscribe_text}' => $this->translator->trans('mautic.email.token.unsubscribe_text'), '{webview_text}' => $this->translator->trans('mautic.email.token.webview_text'), '{signature}' => $this->translator->trans('mautic.email.token.signature'), '{subject}' => $this->translator->trans('mautic.email.subject')];
     if ($event->tokensRequested(array_keys($tokens))) {
         $event->addTokens($event->filterTokens($tokens), true);
     }
     // these should not allow visual tokens
     $tokens = ['{unsubscribe_url}' => $this->translator->trans('mautic.email.token.unsubscribe_url'), '{webview_url}' => $this->translator->trans('mautic.email.token.webview_url')];
     if ($event->tokensRequested(array_keys($tokens))) {
         $event->addTokens($event->filterTokens($tokens));
     }
     if ($event->slotTypesRequested()) {
         $event->addSlotType('text', 'Text', 'font', 'MauticCoreBundle:Slots:text.html.php', 'slot', 1000);
         $event->addSlotType('image', 'Image', 'image', 'MauticCoreBundle:Slots:image.html.php', 'slot', 900);
         $event->addSlotType('button', 'Button', 'external-link', 'MauticCoreBundle:Slots:button.html.php', 'slot_button', 800);
         $event->addSlotType('separator', 'Separator', 'minus', 'MauticCoreBundle:Slots:separator.html.php', 'slot', 700);
     }
 }
Esempio n. 2
0
 /**
  *
  * @param EmailBuilderEvent $event
  */
 public function onEmailBuild(EmailBuilderEvent $event)
 {
     if ($event->abTestWinnerCriteriaRequested()) {
         //add AB Test Winner Criteria
         $formSubmissions = array('group' => 'mautic.form.abtest.criteria', 'label' => 'mautic.form.abtest.criteria.submissions', 'callback' => '\\Mautic\\FormBundle\\Helper\\AbTestHelper::determineSubmissionWinner');
         $event->addAbTestWinnerCriteria('form.submissions', $formSubmissions);
     }
 }
Esempio n. 3
0
 /**
  * @param EmailBuilderEvent $event
  */
 public function onEmailBuild(EmailBuilderEvent $event)
 {
     if ($event->abTestWinnerCriteriaRequested()) {
         //add AB Test Winner Criteria
         $formSubmissions = ['group' => 'mautic.asset.abtest.criteria', 'label' => 'mautic.asset.abtest.criteria.downloads', 'callback' => '\\Mautic\\AssetBundle\\Helper\\AbTestHelper::determineDownloadWinner'];
         $event->addAbTestWinnerCriteria('asset.downloads', $formSubmissions);
     }
 }
Esempio n. 4
0
 public function onEmailBuild(EmailBuilderEvent $event)
 {
     if ($event->tokenSectionsRequested()) {
         //add email tokens
         $content = $this->templating->render('MauticEmailBundle:SubscribedEvents\\EmailToken:token.html.php');
         $event->addTokenSection('email.emailtokens', 'mautic.email.builder.index', $content);
     }
     if ($event->abTestWinnerCriteriaRequested()) {
         //add AB Test Winner Criteria
         $openRate = array('group' => 'mautic.email.stats', 'label' => 'mautic.email.abtest.criteria.open', 'callback' => '\\Mautic\\EmailBundle\\Helper\\AbTestHelper::determineOpenRateWinner');
         $event->addAbTestWinnerCriteria('email.openrate', $openRate);
         $clickThrough = array('group' => 'mautic.email.stats', 'label' => 'mautic.email.abtest.criteria.clickthrough', 'callback' => '\\Mautic\\EmailBundle\\Helper\\AbTestHelper::determineClickthroughRateWinner');
         $event->addAbTestWinnerCriteria('email.clickthrough', $clickThrough);
     }
     $tokens = array('{unsubscribe_text}' => $this->translator->trans('mautic.email.token.unsubscribe_text'), '{unsubscribe_url}' => $this->translator->trans('mautic.email.token.unsubscribe_url'), '{webview_text}' => $this->translator->trans('mautic.email.token.webview_text'), '{webview_url}' => $this->translator->trans('mautic.email.token.webview_url'));
     if ($event->tokensRequested(array_keys($tokens))) {
         unset($tokens['{leadfield}']);
         $event->addTokens($event->filterTokens($tokens), true);
     }
 }