/**
  * Parses variables again
  *
  * @param \In2code\Powermail\Domain\Model\Mail $mail Variables and Labels array
  * @param string $type "web" or "mail"
  * @param string $function "createAction", "senderMail", "receiverMail"
  * @return string Changed string
  */
 public function render(Mail $mail, $type = 'web', $function = 'createAction')
 {
     /** @var \TYPO3\CMS\Fluid\View\StandaloneView $parseObject */
     $parseObject = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $parseObject->setTemplateSource($this->removePowermailAllParagraphTagWrap($this->renderChildren()));
     $parseObject->assignMultiple(ArrayUtility::htmlspecialcharsOnArray($this->mailRepository->getVariablesWithMarkersFromMail($mail)));
     $parseObject->assignMultiple(ArrayUtility::htmlspecialcharsOnArray($this->mailRepository->getLabelsWithMarkersFromMail($mail)));
     $parseObject->assign('powermail_all', TemplateUtility::powermailAll($mail, $type, $this->settings, $function));
     return html_entity_decode($parseObject->render(), ENT_QUOTES, 'UTF-8');
 }
Esempio n. 2
0
 /**
  * Create Email Body
  *
  * @param array $email Array with all needed mail information
  * @return bool
  */
 protected function createEmailBody($email)
 {
     $standaloneView = TemplateUtility::getDefaultStandAloneView();
     $standaloneView->getRequest()->setControllerName('Form');
     $standaloneView->setTemplatePathAndFilename(TemplateUtility::getTemplatePath($email['template'] . '.html'));
     // variables
     $variablesWithMarkers = $this->mailRepository->getVariablesWithMarkersFromMail($this->mail);
     $standaloneView->assignMultiple($variablesWithMarkers);
     $standaloneView->assignMultiple($this->mailRepository->getLabelsWithMarkersFromMail($this->mail));
     $standaloneView->assignMultiple(['variablesWithMarkers' => ArrayUtility::htmlspecialcharsOnArray($variablesWithMarkers), 'powermail_all' => TemplateUtility::powermailAll($this->mail, 'mail', $this->settings, $this->type), 'powermail_rte' => $email['rteBody'], 'marketingInfos' => SessionUtility::getMarketingInfos(), 'mail' => $this->mail, 'email' => $email, 'settings' => $this->settings]);
     if (!empty($email['variables'])) {
         $standaloneView->assignMultiple($email['variables']);
     }
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforeRender', [$standaloneView, $email, $this->mail, $this->settings]);
     $body = $standaloneView->render();
     $this->mail->setBody($body);
     return $body;
 }