Skip to content

Commit 383d614

Browse files
committed
TASK: Introduce site variable in Neos 9
Adjustments for #70
1 parent e9c5b29 commit 383d614

6 files changed

Lines changed: 8 additions & 6 deletions

File tree

Classes/Domain/NodeCreation/PropertiesProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function processAndValidateProperties(TransientNode $node, ProcessingErro
5858
// $messages->getFirstError() doesnt work see https://github.com/neos/flow-development-collection/issues/3370
5959
$flattenedErrors = $messages->getFlattenedErrors();
6060
/** @var Error $firstError */
61-
$firstError = current(current($flattenedErrors));
61+
$firstError = current(current($flattenedErrors) ?: []);
6262
throw new PropertyIgnoredException($firstError->getMessage(), 1686779371122);
6363
}
6464
}

Classes/Domain/TemplateNodeCreationHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
use Flowpack\NodeTemplates\Domain\NodeCreation\NodeCreationService;
88
use Flowpack\NodeTemplates\Domain\TemplateConfiguration\TemplateConfigurationProcessor;
99
use Neos\ContentRepository\Core\ContentRepository;
10+
use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter;
1011
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
1112
use Neos\Flow\Annotations as Flow;
13+
use Neos\Neos\Domain\Service\NodeTypeNameFactory;
1214
use Neos\Neos\Ui\Domain\NodeCreation\NodeCreationCommands;
1315
use Neos\Neos\Ui\Domain\NodeCreation\NodeCreationElements;
1416
use Neos\Neos\Ui\Domain\NodeCreation\NodeCreationHandlerInterface;
@@ -63,7 +65,7 @@ public function handle(
6365

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

Tests/Functional/Features/Variables/NodeTypes.Variables.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
options:
1111
template:
1212
properties:
13-
text: "${'parentNode(' + parentNode.nodeType.name + ', ' + parentNode.name + ') site(' + site.nodeType.name + ', ' + site.name + ')'}"
13+
text: "${'parentNode(' + parentNode.nodeTypeName.value + ', ' + parentNode.name.value + ') site(' + site.nodeTypeName.value + ', ' + site.name.value + ')'}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"properties": {
3-
"text": "parentNode(Neos.Neos:ContentCollection, main) site(unstructured, test-site)"
3+
"text": "parentNode(Neos.Neos:ContentCollection, main) site(Flowpack.NodeTemplates:Document.HomePage, test-site)"
44
}
55
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"properties": {
3-
"text": "parentNode(Neos.Neos:ContentCollection, main) site(unstructured, test-site)"
3+
"text": "parentNode(Neos.Neos:ContentCollection, main) site(Flowpack.NodeTemplates:Document.HomePage, test-site)"
44
},
55
"childNodes": []
66
}

Tests/Functional/Features/Variables/Snapshots/Variables.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
options:
33
template:
44
properties:
5-
text: 'parentNode(Neos.Neos:ContentCollection, main) site(unstructured, test-site)'
5+
text: 'parentNode(Neos.Neos:ContentCollection, main) site(Flowpack.NodeTemplates:Document.HomePage, test-site)'

0 commit comments

Comments
 (0)