/** * @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 = 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'), '{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 = array('{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); } }