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)
 {
     $tokenHelper = new BuilderTokenHelper($this->factory, 'lead.field', 'lead:fields', 'MauticLeadBundle');
     $tokenHelper->setPermissionSet(array('lead:fields:full'));
     if ($event->tokenSectionsRequested()) {
         //add email tokens
         $event->addTokenSection('lead.emailtokens', 'mautic.lead.email.header.index', $tokenHelper->getTokenContent(array('filter' => array('force' => array(array('column' => 'f.isPublished', 'expr' => 'eq', 'value' => true))), 'orderBy' => 'f.label', 'orderByDir' => 'ASC', 'hydration_mode' => 'HYDRATE_ARRAY')), 255);
     }
     if ($event->tokensRequested(self::$leadFieldRegex)) {
         $event->addTokensFromHelper($tokenHelper, self::$leadFieldRegex, 'label', 'alias', true);
     }
 }
Esempio n. 3
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);
     }
 }
 /**
  * Register the tokens and a custom A/B test winner
  *
  * @param EmailBuilderEvent $event
  */
 public function onEmailBuild(EmailBuilderEvent $event)
 {
     $buttons_active = $this->factory->getParameter('buttons_active');
     if (!$buttons_active) {
         return;
     }
     $buttons_colors = $this->factory->getParameter('buttons_colors');
     if (!$buttons_colors) {
         return;
     }
     $params = array();
     $params['colors'] = explode(',', $buttons_colors);
     $params['buttons_width'] = $this->factory->getParameter('buttons_width');
     $params['buttons_height'] = $this->factory->getParameter('buttons_height');
     $params['buttons_radius'] = $this->factory->getParameter('buttons_radius');
     $params['buttons_font_color'] = $this->factory->getParameter('buttons_font_color');
     $params['buttons_font_size'] = $this->factory->getParameter('buttons_font_size');
     $params['buttons_text'] = $this->factory->getParameter('buttons_text');
     // Add email tokens
     $content = $this->templating->render('MauticExtendedPluginBundle:SubscribedEvents\\EmailToken:token.html.php', $params);
     $event->addTokenSection('extendedplugin.token', 'mautic.extendedplugin.email.token.header', $content);
 }
Esempio n. 5
0
 /**
  * @param EmailBuilderEvent $event
  *
  * @return void
  */
 public function onEmailBuild(EmailBuilderEvent $event)
 {
     $tokenHelper = new BuilderTokenHelper($this->factory, 'page');
     if ($event->tokenSectionsRequested()) {
         $event->addTokenSection('page.emailtokens', 'mautic.page.pages', $tokenHelper->getTokenContent(array('filter' => array('force' => array(array('column' => 'p.variantParent', 'expr' => 'isNull'))))), -254);
     }
     if ($event->tokensRequested(array($this->pageTokenRegex))) {
         $event->addTokensFromHelper($tokenHelper, $this->pageTokenRegex, 'title', 'id', false, true);
     }
 }
 /**
  * @param EmailBuilderEvent $event
  */
 public function onEmailBuild(EmailBuilderEvent $event)
 {
     $content = $this->templating->render('LinuxVerBundle:SubscribedEvents\\EmailToken:token.html.php');
     $event->addTokenSection('linuxver.token', 'plugin.linuxver.builder.header', $content);
 }