From 0608751bb9309d08146ee8d74f7dffb1ff0d0a7b Mon Sep 17 00:00:00 2001 From: Bernhard Schmitt Date: Mon, 30 Oct 2023 18:29:14 +0100 Subject: [PATCH 1/2] Properly handle tethered nodes also properly find reference vocabulary node --- Classes/Service/TaxonomyService.php | 10 +++++----- Resources/Private/Fusion/Backend/Form/Taxonomy.fusion | 7 ++++++- .../Private/Fusion/Backend/Form/Vocabulary.fusion | 8 +++++++- .../Private/Fusion/Backend/Views/Taxonomy.List.fusion | 2 +- .../Fusion/Backend/Views/Vocabulary.List.fusion | 4 ++-- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Classes/Service/TaxonomyService.php b/Classes/Service/TaxonomyService.php index 4482108..118570e 100644 --- a/Classes/Service/TaxonomyService.php +++ b/Classes/Service/TaxonomyService.php @@ -21,8 +21,8 @@ use Neos\ContentRepository\Core\NodeType\NodeTypeName; use Neos\ContentRepository\Core\NodeType\NodeTypeNames; use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphInterface; -use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindAncestorNodesFilter; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindChildNodesFilter; +use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindClosestNodeFilter; use Neos\ContentRepository\Core\Projection\ContentGraph\Filter\FindSubtreeFilter; use Neos\ContentRepository\Core\Projection\ContentGraph\Node; use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath; @@ -81,9 +81,9 @@ public function findVocabularyForNode(Node $node): Node { $subgraph = $this->crRegistry->subgraphForNode($node); - $ancestors = $subgraph->findAncestorNodes( + $vocabularyNode = $subgraph->findClosestNode( $node->nodeAggregateId, - FindAncestorNodesFilter::create( + FindClosestNodeFilter::create( NodeTypeConstraints::create( NodeTypeNames::fromArray([ $this->getVocabularyNodeTypeName()]), NodeTypeNames::createEmpty() @@ -91,8 +91,8 @@ public function findVocabularyForNode(Node $node): Node ) ); - if ($result = $ancestors->first()) { - return $result; + if ($vocabularyNode) { + return $vocabularyNode; } throw new \InvalidArgumentException('node seems to be outside of vocabulary'); diff --git a/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion b/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion index 2b4f1dd..5b9f3de 100644 --- a/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion +++ b/Resources/Private/Fusion/Backend/Form/Taxonomy.fusion @@ -26,7 +26,12 @@ prototype(Sitegeist.Taxonomy:Form.Taxonomy) < prototype(Neos.Fusion:Component) { {props.i18nTaxonomy.id('properties.name')} : {props.defaultTaxonomy.properties.name} - +
diff --git a/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion b/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion index a238eb2..8cee6ed 100644 --- a/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion +++ b/Resources/Private/Fusion/Backend/Form/Vocabulary.fusion @@ -24,7 +24,13 @@ prototype(Sitegeist.Taxonomy:Form.Vocabulary) < prototype(Neos.Fusion:Component) - +
diff --git a/Resources/Private/Fusion/Backend/Views/Taxonomy.List.fusion b/Resources/Private/Fusion/Backend/Views/Taxonomy.List.fusion index d70c493..6921eb3 100644 --- a/Resources/Private/Fusion/Backend/Views/Taxonomy.List.fusion +++ b/Resources/Private/Fusion/Backend/Views/Taxonomy.List.fusion @@ -107,7 +107,7 @@ prototype(Sitegeist.Taxonomy:Views.Module.Taxonomy.List.Item) < prototype(Neos.F - +  
- +
From 48fa93a19858d8012e0facfa85ff66e20b8cac47 Mon Sep 17 00:00:00 2001 From: Bernhard Schmitt Date: Fri, 17 Nov 2023 14:11:45 +0100 Subject: [PATCH 2/2] Remove redundant StopCommandException --- Classes/Command/TaxonomyCommandController.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Classes/Command/TaxonomyCommandController.php b/Classes/Command/TaxonomyCommandController.php index 3649666..cfd197c 100644 --- a/Classes/Command/TaxonomyCommandController.php +++ b/Classes/Command/TaxonomyCommandController.php @@ -74,7 +74,6 @@ public function taxonomiesCommand(string $vocabulary, string $path = ''): void if (!$startPoint) { $this->outputLine('nothing found'); $this->quit(1); - throw new StopCommandException(); } $subtree = $this->taxonomyService->findSubtree($startPoint);