Skip to content

Commit

Permalink
TASK: Introduce site variable in Neos 9
Browse files Browse the repository at this point in the history
Adjustments for #70
  • Loading branch information
mhsdesign committed Jun 21, 2024
1 parent e9c5b29 commit 383d614
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Classes/Domain/NodeCreation/PropertiesProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function processAndValidateProperties(TransientNode $node, ProcessingErro
// $messages->getFirstError() doesnt work see https://github.com/neos/flow-development-collection/issues/3370
$flattenedErrors = $messages->getFlattenedErrors();
/** @var Error $firstError */
$firstError = current(current($flattenedErrors));
$firstError = current(current($flattenedErrors) ?: []);
throw new PropertyIgnoredException($firstError->getMessage(), 1686779371122);
}
}
Expand Down
4 changes: 3 additions & 1 deletion Classes/Domain/TemplateNodeCreationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
use Flowpack\NodeTemplates\Domain\NodeCreation\NodeCreationService;
use Flowpack\NodeTemplates\Domain\TemplateConfiguration\TemplateConfigurationProcessor;
use Neos\ContentRepository\Core\ContentRepository;
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\Flow\Annotations as Flow;
use Neos\Neos\Domain\Service\NodeTypeNameFactory;
use Neos\Neos\Ui\Domain\NodeCreation\NodeCreationCommands;
use Neos\Neos\Ui\Domain\NodeCreation\NodeCreationElements;
use Neos\Neos\Ui\Domain\NodeCreation\NodeCreationHandlerInterface;
Expand Down Expand Up @@ -63,7 +65,7 @@ public function handle(

$evaluationContext = [
'data' => iterator_to_array($elements->serialized()),
'site' => null, // todo
'site' => $subgraph->findClosestNode($commands->first->parentNodeAggregateId, FindClosestNodeFilter::create(NodeTypeNameFactory::NAME_SITE)),
'parentNode' => $subgraph->findNodeById($commands->first->parentNodeAggregateId)
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
options:
template:
properties:
text: "${'parentNode(' + parentNode.nodeType.name + ', ' + parentNode.name + ') site(' + site.nodeType.name + ', ' + site.name + ')'}"
text: "${'parentNode(' + parentNode.nodeTypeName.value + ', ' + parentNode.name.value + ') site(' + site.nodeTypeName.value + ', ' + site.name.value + ')'}"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"properties": {
"text": "parentNode(Neos.Neos:ContentCollection, main) site(unstructured, test-site)"
"text": "parentNode(Neos.Neos:ContentCollection, main) site(Flowpack.NodeTemplates:Document.HomePage, test-site)"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"properties": {
"text": "parentNode(Neos.Neos:ContentCollection, main) site(unstructured, test-site)"
"text": "parentNode(Neos.Neos:ContentCollection, main) site(Flowpack.NodeTemplates:Document.HomePage, test-site)"
},
"childNodes": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
options:
template:
properties:
text: 'parentNode(Neos.Neos:ContentCollection, main) site(unstructured, test-site)'
text: 'parentNode(Neos.Neos:ContentCollection, main) site(Flowpack.NodeTemplates:Document.HomePage, test-site)'

0 comments on commit 383d614

Please sign in to comment.