Example #1
0
 /**
  * [initializeObject description]
  * @return void
  */
 public function initializeObject()
 {
     if (empty($this->array)) {
         $settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS);
         $this->mergeSettings($settings);
     }
 }
 /**
  * [renderTemplate description].
  *
  * @param string $templateName Template name
  * @param array  $variables
  * @param string $format       [description]
  *
  * @return string [description]
  */
 protected function renderTemplate($templateName, $variables, $format)
 {
     $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $partialRootPaths = isset($extbaseFrameworkConfiguration['view']['partialRootPaths']) ? $extbaseFrameworkConfiguration['view']['partialRootPaths'] : [0 => $extbaseFrameworkConfiguration['view']['partialRootPath']];
     $layoutRootPaths = isset($extbaseFrameworkConfiguration['view']['layoutRootPaths']) ? $extbaseFrameworkConfiguration['view']['layoutRootPaths'] : [0 => $extbaseFrameworkConfiguration['view']['layoutRootPath']];
     $templateRootPaths = isset($extbaseFrameworkConfiguration['view']['templateRootPaths']) ? $extbaseFrameworkConfiguration['view']['templateRootPaths'] : [0 => $extbaseFrameworkConfiguration['view']['templateRootPath']];
     $templatePathAndFilename = null;
     foreach (array_reverse($templateRootPaths) as $templateRootPath) {
         $templatePathAndFilename = GeneralUtility::getFileAbsFileName(rtrim($templateRootPath, '/') . '/MailMessage/' . $templateName . '.' . $format);
         if (file_exists($templatePathAndFilename)) {
             break;
         } else {
             $templatePathAndFilename = null;
         }
     }
     if ($templatePathAndFilename === null) {
         throw new FluidmailException("Template 'MailMessage/{$templateName}.{$format}' not found!", 1429045685);
     }
     if (isset($variables[self::VARIABLE_NAME])) {
         throw new FluidmailException(sprintf("Variable name '%s' is reserved", self::VARIABLE_NAME), 1451333653);
     }
     $variables[self::VARIABLE_NAME] = $this;
     /** @var \TYPO3\CMS\Fluid\View\StandaloneView $view */
     $view = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $view->setFormat($format);
     $view->setTemplatePathAndFilename($templatePathAndFilename);
     $view->setLayoutRootPaths($layoutRootPaths);
     $view->setPartialRootPaths($partialRootPaths);
     $view->assignMultiple($variables);
     return $view->render();
 }