Esempio n. 1
0
 /**
  * Add forms to available page tokens
  *
  * @param PageBuilderEvent $event
  */
 public function onPageBuild(PageBuilderEvent $event)
 {
     if ($event->abTestWinnerCriteriaRequested()) {
         //add AB Test Winner Criteria
         $assetDownloads = array('group' => 'mautic.asset.abtest.criteria', 'label' => 'mautic.asset.abtest.criteria.downloads', 'callback' => '\\Mautic\\AssetBundle\\Helper\\AbTestHelper::determineDownloadWinner');
         $event->addAbTestWinnerCriteria('asset.downloads', $assetDownloads);
     }
 }
Esempio n. 2
0
 /**
  * Add forms to available page tokens.
  *
  * @param PageBuilderEvent $event
  */
 public function onPageBuild(PageBuilderEvent $event)
 {
     $tokenHelper = new BuilderTokenHelper($this->factory, 'focus', $this->model->getPermissionBase(), 'MauticFocusBundle', 'mautic.focus');
     if ($event->tokenSectionsRequested()) {
         $event->addTokenSection('mautic.focustokens', 'mautic.focus.focus_items', $tokenHelper->getTokenContent());
     }
     if ($event->tokensRequested($this->regex)) {
         $event->addTokensFromHelper($tokenHelper, $this->regex, 'name', 'id', true);
     }
 }
Esempio n. 3
0
 /**
  * Add forms to available page tokens
  *
  * @param PageBuilderEvent $event
  */
 public function onPageBuild(PageBuilderEvent $event)
 {
     $tokenHelper = new BuilderTokenHelper($this->factory, 'form');
     if ($event->tokenSectionsRequested()) {
         $event->addTokenSection('form.pagetokens', 'mautic.form.forms', $tokenHelper->getTokenContent());
     }
     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);
     }
     if ($event->tokensRequested($this->formRegex)) {
         $event->addTokensFromHelper($tokenHelper, $this->formRegex, 'name', 'id', true);
     }
 }
Esempio n. 4
0
 /**
  * Add forms to available page tokens
  *
  * @param Events\PageBuilderEvent $event
  */
 public function onPageBuild(Events\PageBuilderEvent $event)
 {
     $tokenHelper = new BuilderTokenHelper($this->factory, 'page');
     if ($event->tokenSectionsRequested()) {
         //add extra tokens
         $content = $this->templating->render('MauticPageBundle:SubscribedEvents\\PageToken:token.html.php');
         $event->addTokenSection('page.extratokens', 'mautic.page.builder.header.extra', $content, 2);
         //add pagetokens
         $event->addTokenSection('page.pagetokens', 'mautic.page.pages', $tokenHelper->getTokenContent(array('filter' => array('force' => array(array('column' => 'p.variantParent', 'expr' => 'isNull'))))), -254);
     }
     if ($event->abTestWinnerCriteriaRequested()) {
         //add AB Test Winner Criteria
         $bounceRate = array('group' => 'mautic.page.abtest.criteria', 'label' => 'mautic.page.abtest.criteria.bounce', 'callback' => '\\Mautic\\PageBundle\\Helper\\AbTestHelper::determineBounceTestWinner');
         $event->addAbTestWinnerCriteria('page.bouncerate', $bounceRate);
         $dwellTime = array('group' => 'mautic.page.abtest.criteria', 'label' => 'mautic.page.abtest.criteria.dwelltime', 'callback' => '\\Mautic\\PageBundle\\Helper\\AbTestHelper::determineDwellTimeTestWinner');
         $event->addAbTestWinnerCriteria('page.dwelltime', $dwellTime);
     }
     if ($event->tokensRequested(array($this->pageTokenRegex))) {
         $event->addTokensFromHelper($tokenHelper, $this->pageTokenRegex, 'title', 'id', false, true);
         $event->addTokens($event->filterTokens(array($this->shareButtonsRegex => $this->translator->trans('mautic.page.token.lang'), $this->langBarRegex => $this->translator->trans('mautic.page.token.share'))));
     }
 }
Esempio n. 5
0
 /**
  * Add forms to available page tokens.
  *
  * @param Events\PageBuilderEvent $event
  */
 public function onPageBuild(Events\PageBuilderEvent $event)
 {
     $tokenHelper = new BuilderTokenHelper($this->factory, 'page');
     if ($event->tokenSectionsRequested()) {
         //add extra tokens
         $content = $this->templating->render('MauticPageBundle:SubscribedEvents\\PageToken:token.html.php');
         $event->addTokenSection('page.extratokens', 'mautic.page.builder.header.extra', $content, 2);
         //add pagetokens
         $event->addTokenSection('page.pagetokens', 'mautic.page.pages', $tokenHelper->getTokenContent(['filter' => ['force' => [['column' => 'p.variantParent', 'expr' => 'isNull']]]]), -254);
     }
     if ($event->abTestWinnerCriteriaRequested()) {
         //add AB Test Winner Criteria
         $bounceRate = ['group' => 'mautic.page.abtest.criteria', 'label' => 'mautic.page.abtest.criteria.bounce', 'callback' => '\\Mautic\\PageBundle\\Helper\\AbTestHelper::determineBounceTestWinner'];
         $event->addAbTestWinnerCriteria('page.bouncerate', $bounceRate);
         $dwellTime = ['group' => 'mautic.page.abtest.criteria', 'label' => 'mautic.page.abtest.criteria.dwelltime', 'callback' => '\\Mautic\\PageBundle\\Helper\\AbTestHelper::determineDwellTimeTestWinner'];
         $event->addAbTestWinnerCriteria('page.dwelltime', $dwellTime);
     }
     if ($event->tokensRequested([$this->pageTokenRegex])) {
         $event->addTokensFromHelper($tokenHelper, $this->pageTokenRegex, 'title', 'id', false, true);
         $event->addTokens($event->filterTokens([$this->langBarRegex => $this->translator->trans('mautic.page.token.lang'), $this->shareButtonsRegex => $this->translator->trans('mautic.page.token.share'), $this->titleRegex => $this->translator->trans('mautic.core.title'), $this->descriptionRegex => $this->translator->trans('mautic.page.form.metadescription')]));
     }
     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);
     }
 }