Exemplo n.º 1
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'));
     $standaloneView->setLayoutRootPaths(TemplateUtility::getTemplateFolders('layout'));
     $standaloneView->setPartialRootPaths(TemplateUtility::getTemplateFolders('partial'));
     // variables
     $variablesWithMarkers = $this->mailRepository->getVariablesWithMarkersFromMail($this->mail);
     $standaloneView->assignMultiple($variablesWithMarkers);
     $standaloneView->assignMultiple($this->mailRepository->getLabelsWithMarkersFromMail($this->mail));
     $standaloneView->assignMultiple(array('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', array($standaloneView, $email, $this->mail, $this->settings));
     $body = $standaloneView->render();
     $this->mail->setBody($body);
     return $body;
 }