/** * @param NodeInterface $node * @return string * @throws NeosException */ public function render(NodeInterface $node) { if ($this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess') === false) { return ''; } /** @var $actionRequest ActionRequest */ $actionRequest = $this->controllerContext->getRequest(); $innerView = new StandaloneView($actionRequest); $innerView->setTemplatePathAndFilename('resource://Neos.Neos/Private/Templates/Backend/Content/Container.html'); $innerView->setFormat('html'); $innerView->setPartialRootPath('resource://Neos.Neos/Private/Partials'); $user = $this->partyService->getAssignedPartyOfAccount($this->securityContext->getAccount()); $innerView->assignMultiple(array('node' => $node, 'modules' => $this->menuHelper->buildModuleList($this->controllerContext), 'sites' => $this->menuHelper->buildSiteList($this->controllerContext), 'user' => $user)); return $innerView->render(); }
/** * Sends an activation mail for $token to the given $recipientAddress. * * The mail is built and sent according to the configuration given in the preset assigned to the $token. * * @param string $recipientAddress * @param Token $token * @param array $additionalTemplateVariables * @return int */ public function sendActivationMail($recipientAddress, Token $token, array $additionalTemplateVariables = []) { $preset = $token->getPreset(); $activationLink = $this->getActivationLink($token); $mail = new Message(); $mail->setFrom([$preset['mail']['from']['address'] => $preset['mail']['from']['name']])->setTo($recipientAddress)->setSubject($preset['mail']['subject']); $templateVariables = array_merge(['activationLink' => $activationLink, 'recipientAddress' => $recipientAddress, 'token' => $token, 'meta' => $token->getMeta()], $additionalTemplateVariables); $this->fluidView->setTemplatePathAndFilename($preset['mail']['message']['plaintext']); $this->fluidView->assignMultiple($templateVariables); $mail->setBody($this->fluidView->render(), 'text/plain'); if (isset($preset['mail']['html'])) { $this->fluidView->setTemplatePathAndFilename($preset['mail']['message']['html']); $this->fluidView->assignMultiple($templateVariables); $mail->setBody($this->fluidView->render(), 'text/html'); } return $mail->send(); }
/** * Render the given template file with the given variables * * @param string $templatePathAndFilename * @param array $contextVariables * @return string * @throws \Neos\FluidAdaptor\Core\Exception */ protected function renderTemplate($templatePathAndFilename, array $contextVariables) { $standaloneView = new StandaloneView(); $standaloneView->setTemplatePathAndFilename($templatePathAndFilename); $standaloneView->assignMultiple($contextVariables); return $standaloneView->render(); }