public function getContentPreviewAction(ParamFetcher $paramFetcher) { $template = $paramFetcher->get('template'); $type = $paramFetcher->get('type'); $content = $paramFetcher->get('content'); $nodeId = $paramFetcher->get('nodeId'); $domainId = $paramFetcher->get('domainId'); //todo, check if $template is defined as content template $contentObject = new Content(); $contentObject->setType($type); $contentObject->setTemplate($template); $contentObject->setContent($content); if ($domainId) { $domain = $this->pageStack->getDomain($domainId); $this->pageStack->setCurrentDomain($domain); } if ($nodeId) { $page = $this->pageStack->getPage($nodeId); $this->pageStack->setCurrentPage($page); } return $this->contentRender->renderContent($contentObject, ['preview' => true]); }