Ejemplo n.º 1
0
 /**
  * Create Email Body
  *
  * @param array $email Array with all needed mail information
  * @param \In2code\Powermail\Domain\Model\Mail $mail
  * @param array $settings TypoScript Settings
  * @return bool
  */
 protected function createEmailBody($email, \In2code\Powermail\Domain\Model\Mail &$mail, $settings)
 {
     $emailBodyObject = $this->objectManager->get('\\TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $emailBodyObject->getRequest()->setControllerExtensionName('Powermail');
     $emailBodyObject->getRequest()->setPluginName('Pi1');
     $emailBodyObject->getRequest()->setControllerName('Form');
     $emailBodyObject->setFormat('html');
     $templatePathAndFilename = $this->div->getTemplatePath() . $email['template'] . '.html';
     $emailBodyObject->setTemplatePathAndFilename($templatePathAndFilename);
     $emailBodyObject->setLayoutRootPath($this->div->getTemplatePath('layout'));
     $emailBodyObject->setPartialRootPath($this->div->getTemplatePath('partial'));
     // get variables
     // additional variables
     if (isset($email['variables']) && is_array($email['variables'])) {
         $emailBodyObject->assignMultiple($email['variables']);
     }
     // markers in HTML Template
     $variablesWithMarkers = $this->div->getVariablesWithMarkers($mail);
     $emailBodyObject->assign('variablesWithMarkers', $this->div->htmlspecialcharsOnArray($variablesWithMarkers));
     $emailBodyObject->assignMultiple($variablesWithMarkers);
     $emailBodyObject->assignMultiple($this->div->getLabelsAttachedToMarkers($mail));
     $emailBodyObject->assign('powermail_all', $this->div->powermailAll($mail, 'mail', $settings));
     // from rte
     $emailBodyObject->assign('powermail_rte', $email['rteBody']);
     $emailBodyObject->assign('marketingInfos', Div::getMarketingInfos());
     $emailBodyObject->assign('mail', $mail);
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforeRender', array($emailBodyObject, $email, $mail, $settings));
     $body = $emailBodyObject->render();
     $mail->setBody($body);
     return $body;
 }