/** * @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(); }
/** * @param NodeInterface $node * @return string * @throws NeosException */ public function render(NodeInterface $node) { if ($this->privilegeManager->isPrivilegeTargetGranted('TYPO3.Neos:Backend.GeneralAccess') === false) { return ''; } /** @var $actionRequest ActionRequest */ $actionRequest = $this->controllerContext->getRequest(); $innerView = new StandaloneView($actionRequest); $innerView->setTemplatePathAndFilename('resource://TYPO3.Neos/Private/Templates/Backend/Content/Container.html'); $innerView->setFormat('html'); $innerView->setPartialRootPath('resource://TYPO3.Neos/Private/Partials'); $user = $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User'); $innerView->assignMultiple(array('node' => $node, 'modules' => $this->menuHelper->buildModuleList($this->controllerContext), 'sites' => $this->menuHelper->buildSiteList($this->controllerContext), 'user' => $user)); return $innerView->render(); }
/** * @param string $sitePackage * @param string $siteName * @param string $baseDomain * @return Site */ public function importSiteFromTemplate($sitePackage, $siteName, $baseDomain = '') { if (empty($baseDomain)) { $request = Request::createFromEnvironment(); $baseDomain = $request->getBaseUri()->getHost(); } $siteTemplate = new StandaloneView(); $siteTemplate->setTemplatePathAndFilename(FLOW_PATH_PACKAGES . 'Sites/' . $sitePackage . '/Resources/Private/Templates/Content/Sites.xml'); $siteTemplate->assignMultiple(['siteName' => $siteName, 'siteNodeName' => \TYPO3\TYPO3CR\Utility::renderValidNodeName($siteName), 'packageKey' => $sitePackage]); $generatedSiteImportXmlContent = $siteTemplate->render(); $dataTemporaryPath = $this->environment->getPathToTemporaryDirectory(); $temporarySiteXml = $dataTemporaryPath . uniqid($siteName) . '.xml'; file_put_contents($temporarySiteXml, $generatedSiteImportXmlContent); $site = $this->siteImportService->importFromFile($temporarySiteXml); $domain = new Domain(); $domain->setActive(true); $domain->setSite($site); $domain->setHostPattern(\TYPO3\TYPO3CR\Utility::renderValidNodeName($siteName) . '.' . $baseDomain); $this->domainRepository->add($domain); return $site; }
/** * 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; }