Skip to content

Commit

Permalink
TASK: Check for correct context
Browse files Browse the repository at this point in the history
Log and return silently if the context
could not be retrievd
  • Loading branch information
daniellienert committed Apr 1, 2021
1 parent 0ab4932 commit 780b32c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Classes/Service/FusionRenderingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ class FusionRenderingService
*/
public function render(NodeInterface $node, string $fusionPath, array $contextData = [])
{
if (!$node instanceof NodeInterface || $node === null) {
return '';
}

$dimensions = $node->getDimensions();
$context = $this->createContentContext($node->getWorkspace()->getName(), $dimensions);
$node = $context->getNodeByIdentifier($node->getIdentifier());

$currentSiteNode = $context->getCurrentSiteNode();

if (!$currentSiteNode instanceof NodeInterface) {
$this->logger->error(sprintf('Could not get the current site node for node "%s". Rendering skipped.', (string)$node), LogEnvironment::fromMethodName(__METHOD__));
return '';
}

$fusionRuntime = $this->getFusionRuntime($currentSiteNode);

if (array_key_exists('language', $dimensions) && $dimensions['language'] !== []) {
Expand Down

0 comments on commit 780b32c

Please sign in to comment.