/** * @param string $templateIdentifier * @param string $format * @param array $variables * @return string */ protected function renderEmailBody($templateIdentifier, $format, array $variables) { // Default package to use $templatePackage = $this->templatePackage ? $this->templatePackage : 'Sandstorm.UserManagement'; $standaloneView = new StandaloneView(); $request = $standaloneView->getRequest(); $request->setControllerPackageKey($templatePackage); $request->setFormat($format); $templatePathAndFilename = sprintf('resource://' . $templatePackage . '/Private/EmailTemplates/%s.%s', $templateIdentifier, $format); $standaloneView->setTemplatePathAndFilename($templatePathAndFilename); $standaloneView->assignMultiple($variables); return $standaloneView->render(); }
/** * Prepares a Fluid view for rendering the custom error page. * * @param \Exception $exception * @param array $renderingOptions Rendering options as defined in the settings * @return StandaloneView */ protected function buildCustomFluidView(\Exception $exception, array $renderingOptions) { $statusCode = 500; $referenceCode = NULL; if ($exception instanceof FlowException) { $statusCode = $exception->getStatusCode(); $referenceCode = $exception->getReferenceCode(); } $statusMessage = Response::getStatusMessageByCode($statusCode); $fluidView = new StandaloneView(); $fluidView->getRequest()->setControllerPackageKey('TYPO3.Flow'); $fluidView->setTemplatePathAndFilename($renderingOptions['templatePathAndFilename']); if (isset($renderingOptions['layoutRootPath'])) { $fluidView->setLayoutRootPath($renderingOptions['layoutRootPath']); } if (isset($renderingOptions['partialRootPath'])) { $fluidView->setPartialRootPath($renderingOptions['partialRootPath']); } if (isset($renderingOptions['format'])) { $fluidView->setFormat($renderingOptions['format']); } if (isset($renderingOptions['variables'])) { $fluidView->assignMultiple($renderingOptions['variables']); } $fluidView->assignMultiple(array('exception' => $exception, 'renderingOptions' => $renderingOptions, 'statusCode' => $statusCode, 'statusMessage' => $statusMessage, 'referenceCode' => $referenceCode)); return $fluidView; }
/** * @return StandaloneView */ protected function createStandaloneView() { // initialize view $standaloneView = new StandaloneView(); $actionRequest = $standaloneView->getRequest(); // inject TYPO3.Flow settings to fetch base URI configuration & set default package key $flowSettings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow'); if (isset($flowSettings['http']['baseUri'])) { $actionRequest->getHttpRequest()->setBaseUri($flowSettings['http']['baseUri']); } $actionRequest->setControllerPackageKey('T3DD.Backend'); return $standaloneView; }
/** * @param string $defaultPackageKey * @return StandaloneView */ protected function createStandaloneView($defaultPackageKey = null) { // initialize router $this->router->setRoutesConfiguration($this->routesConfiguration); // initialize view $standaloneView = new StandaloneView(); $actionRequest = $standaloneView->getRequest(); // inject TYPO3.Flow settings to fetch base URI configuration & set default package key if (isset($this->flowSettings['http']['baseUri'])) { $actionRequest->getHttpRequest()->setBaseUri($this->flowSettings['http']['baseUri']); } $actionRequest->setControllerPackageKey($defaultPackageKey); return $standaloneView; }