Skip to content

Commit

Permalink
TASK: Use correct renderingMode in out of band rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Sep 16, 2023
1 parent 58cb5f2 commit 7e57498
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* source code.
*/

use Neos\Neos\Domain\Service\RenderingModeService;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
Expand Down Expand Up @@ -49,6 +50,9 @@ class ReloadContentOutOfBand extends AbstractFeedback
*/
protected $contentRepositoryRegistry;

#[Flow\Inject]
protected RenderingModeService $renderingModeService;

public function setNode(Node $node): void
{
$this->node = $node;
Expand Down Expand Up @@ -131,8 +135,11 @@ protected function renderContent(ControllerContext $controllerContext): string|R
}

if ($this->nodeDomAddress) {
$renderingMode = $this->renderingModeService->findByCurrentUser();

$fusionView = new FusionView();
$fusionView->setControllerContext($controllerContext);
$fusionView->setOption('renderingModeName', $renderingMode->name);

$fusionView->assign('value', $this->node);
$fusionView->setFusionPath($this->nodeDomAddress->getFusionPathForContentRendering());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\Neos\Domain\Service\RenderingModeService;
use Neos\Neos\FrontendRouting\NodeAddressFactory;
use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry;
use Neos\Flow\Annotations as Flow;
Expand Down Expand Up @@ -59,6 +60,9 @@ class RenderContentOutOfBand extends AbstractFeedback
*/
protected $contentRepositoryRegistry;

#[Flow\Inject]
protected RenderingModeService $renderingModeService;

public function setNode(Node $node): void
{
$this->node = $node;
Expand Down Expand Up @@ -177,8 +181,11 @@ protected function renderContent(ControllerContext $controllerContext): string|R

$parentDomAddress = $this->getParentDomAddress();
if ($parentDomAddress) {
$renderingMode = $this->renderingModeService->findByCurrentUser();

$fusionView = new FusionView();
$fusionView->setControllerContext($controllerContext);
$fusionView->setOption('renderingModeName', $renderingMode->name);

$fusionView->assign('value', $parentNode);
$fusionView->setFusionPath($parentDomAddress->getFusionPath());
Expand Down

0 comments on commit 7e57498

Please sign in to comment.