From 17800c69b3ad7909e2b1ac38e9314beeb658df5c Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 22 Jun 2024 19:33:36 +0200 Subject: [PATCH 1/3] FEATURE: Add option to hide/disable nodes This reverts commit 4fa4f452c290511fb0c47717ec0d42828eceb6ee. --- Classes/Domain/NodeCreation/NodeCreationService.php | 8 ++++++++ Classes/Domain/NodeCreation/PropertiesProcessor.php | 3 +++ Classes/Domain/Template/RootTemplate.php | 13 +++++++++++-- Classes/Domain/Template/Template.php | 11 ++++++++++- Classes/Domain/Template/Templates.php | 1 + .../TemplateConfigurationProcessor.php | 1 + .../Domain/TemplateConfiguration/TemplatePart.php | 4 ++-- README.md | 11 +++++++++++ 8 files changed, 47 insertions(+), 5 deletions(-) diff --git a/Classes/Domain/NodeCreation/NodeCreationService.php b/Classes/Domain/NodeCreation/NodeCreationService.php index d6dd160..61cf247 100644 --- a/Classes/Domain/NodeCreation/NodeCreationService.php +++ b/Classes/Domain/NodeCreation/NodeCreationService.php @@ -53,6 +53,10 @@ public function createMutatorsForRootTemplate(RootTemplate $template, NodeType $ $this->referencesProcessor->processAndValidateReferences($node, $processingErrors) ); + if ($template->getDisabled() === true) { + $node->setHidden(true); + } + return NodeMutatorCollection::from( NodeMutator::setProperties($validProperties), $this->createMutatorForUriPathSegment($template->getProperties()), @@ -164,6 +168,10 @@ private function createMutatorsForChildNodeTemplates(Templates $templates, Trans } + if ($template->getDisabled() === true) { + $node->setHidden(true); + } + return $nodeMutators; } diff --git a/Classes/Domain/NodeCreation/PropertiesProcessor.php b/Classes/Domain/NodeCreation/PropertiesProcessor.php index 0c1f17a..329d79a 100644 --- a/Classes/Domain/NodeCreation/PropertiesProcessor.php +++ b/Classes/Domain/NodeCreation/PropertiesProcessor.php @@ -94,6 +94,9 @@ private function assertValidPropertyName($propertyName): void } if ($propertyName[0] === '_') { $lowerPropertyName = strtolower($propertyName); + if ($lowerPropertyName === '_hidden') { + throw new PropertyIgnoredException('Using "_hidden" as property declaration was removed. Please use "disabled" on the first level instead.'); + } foreach ($legacyInternalProperties as $legacyInternalProperty) { if ($lowerPropertyName === strtolower($legacyInternalProperty)) { throw new PropertyIgnoredException(sprintf('Because internal legacy property "%s" not implement.', $propertyName), 1686149513158); diff --git a/Classes/Domain/Template/RootTemplate.php b/Classes/Domain/Template/RootTemplate.php index 229b7cd..9d07b7c 100644 --- a/Classes/Domain/Template/RootTemplate.php +++ b/Classes/Domain/Template/RootTemplate.php @@ -12,6 +12,8 @@ */ class RootTemplate implements \JsonSerializable { + private ?bool $disabled; + /** * @var array */ @@ -23,15 +25,21 @@ class RootTemplate implements \JsonSerializable * @internal * @param array $properties */ - public function __construct(array $properties, Templates $childNodes) + public function __construct(?bool $disabled, array $properties, Templates $childNodes) { + $this->disabled = $disabled; $this->properties = $properties; $this->childNodes = $childNodes; } public static function empty(): self { - return new RootTemplate([], Templates::empty()); + return new RootTemplate(null, [], Templates::empty()); + } + + public function getDisabled(): ?bool + { + return $this->disabled; } /** @@ -50,6 +58,7 @@ public function getChildNodes(): Templates public function jsonSerialize(): array { return [ + 'disabled' => $this->disabled, 'properties' => $this->properties, 'childNodes' => $this->childNodes ]; diff --git a/Classes/Domain/Template/Template.php b/Classes/Domain/Template/Template.php index c8f98ef..aa46f2c 100644 --- a/Classes/Domain/Template/Template.php +++ b/Classes/Domain/Template/Template.php @@ -18,6 +18,8 @@ class Template implements \JsonSerializable private ?NodeName $name; + private ?bool $disabled; + /** * @var array */ @@ -29,10 +31,11 @@ class Template implements \JsonSerializable * @internal * @param array $properties */ - public function __construct(?NodeTypeName $type, ?NodeName $name, array $properties, Templates $childNodes) + public function __construct(?NodeTypeName $type, ?NodeName $name, ?bool $disabled, array $properties, Templates $childNodes) { $this->type = $type; $this->name = $name; + $this->disabled = $disabled; $this->properties = $properties; $this->childNodes = $childNodes; } @@ -47,6 +50,11 @@ public function getName(): ?NodeName return $this->name; } + public function getDisabled(): ?bool + { + return $this->disabled; + } + /** * @return array */ @@ -65,6 +73,7 @@ public function jsonSerialize(): array return [ 'type' => $this->type, 'name' => $this->name, + 'disabled' => $this->disabled, 'properties' => $this->properties, 'childNodes' => $this->childNodes ]; diff --git a/Classes/Domain/Template/Templates.php b/Classes/Domain/Template/Templates.php index a7f65c3..b7b65f6 100644 --- a/Classes/Domain/Template/Templates.php +++ b/Classes/Domain/Template/Templates.php @@ -50,6 +50,7 @@ public function toRootTemplate(): RootTemplate } foreach ($this->items as $first) { return new RootTemplate( + $first->getDisabled(), $first->getProperties(), $first->getChildNodes() ); diff --git a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php index 5e5f189..b87b39e 100644 --- a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php +++ b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php @@ -139,6 +139,7 @@ private function createTemplateFromTemplatePart(TemplatePart $templatePart): Tem return new Template( $type !== null ? NodeTypeName::fromString($type) : null, $name !== null ? NodeName::fromString(Utility::renderValidNodeName($name)) : null, + $templatePart->hasConfiguration('disabled') ? (bool)$templatePart->processConfiguration('disabled') : null, $processedProperties, $childNodeTemplates ); diff --git a/Classes/Domain/TemplateConfiguration/TemplatePart.php b/Classes/Domain/TemplateConfiguration/TemplatePart.php index d204ca6..9ba8e16 100644 --- a/Classes/Domain/TemplateConfiguration/TemplatePart.php +++ b/Classes/Domain/TemplateConfiguration/TemplatePart.php @@ -210,7 +210,7 @@ private function validateTemplateConfigurationKeys(): void { $isRootTemplate = $this->fullPathToConfiguration === []; foreach (array_keys($this->configuration) as $key) { - if (!in_array($key, ['type', 'name', 'properties', 'childNodes', 'when', 'withItems', 'withContext'], true)) { + if (!in_array($key, ['type', 'name', 'disabled', 'properties', 'childNodes', 'when', 'withItems', 'withContext'], true)) { $this->addProcessingErrorForPath( new \InvalidArgumentException(sprintf('Template configuration has illegal key "%s"', $key), 1686150349274), $key @@ -218,7 +218,7 @@ private function validateTemplateConfigurationKeys(): void throw new StopBuildingTemplatePartException(); } if ($isRootTemplate) { - if (!in_array($key, ['properties', 'childNodes', 'when', 'withContext'], true)) { + if (!in_array($key, ['disabled', 'properties', 'childNodes', 'when', 'withContext'], true)) { $this->addProcessingErrorForPath( new \InvalidArgumentException(sprintf('Root template configuration doesnt allow option "%s', $key), 1686150340657), $key diff --git a/README.md b/README.md index 7955659..b221f56 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,17 @@ The following example creates three different text child nodes in the main conte We call conditions ``when`` and loops ``withItems`` (instead of ``if`` and ``forEach``), because it inspires a more declarative mood. The naming is inspired by Ansible. +## Disable nodes (in version 1.0 "_hidden") + +The following example disables a newly created node: + +```yaml +'Neos.NodeTypes:Page': + options: + template: + disabled: true +``` + ## EEL context variables There are several variables available in the EEL context for example. From c682516110655efca2199c149b4b8ff565f8a162 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 22 Jun 2024 20:08:49 +0200 Subject: [PATCH 2/3] FEATURE: Adjust disabled feature to work with NodeMutator architecture - introduce $showDisabledNodesInSubgraph in tests to show disabled created nodes - introduce `NodeMutator::setDisabled` - updated all snapshots to include `"disabled": false,` --- .../NodeCreation/NodeCreationService.php | 12 ++------ Classes/Domain/NodeCreation/NodeMutator.php | 13 +++++++++ .../NodeCreation/NodeMutatorCollection.php | 2 +- .../NodeCreation/PropertiesProcessor.php | 2 +- Classes/Domain/Template/RootTemplate.php | 8 +++--- Classes/Domain/Template/Template.php | 6 ++-- .../TemplateConfigurationProcessor.php | 2 +- .../AbstractNodeTemplateTestCase.php | 28 +++++++++++-------- .../Snapshots/AllowedChildNodes.template.json | 3 ++ .../Snapshots/ChildNodes.template.json | 5 ++++ .../DisallowedChildNodes.template.json | 4 +++ .../Features/Disabled/DisabledTest.php | 27 ++++++++++++++++++ .../Features/Disabled/NodeTypes.Disabled.yaml | 7 +++++ .../Disabled/Snapshots/Disabled.nodes.json | 3 ++ .../Disabled/Snapshots/Disabled.template.json | 5 ++++ .../Features/Disabled/Snapshots/Disabled.yaml | 3 ++ .../Snapshots/OnlyExceptions.template.json | 1 + .../Snapshots/SomeExceptions.messages.json | 2 +- .../Snapshots/SomeExceptions.template.json | 9 ++++++ .../Snapshots/NestedNodeNames.template.json | 3 ++ .../Snapshots/NodeNames.template.json | 6 ++++ .../Pages/Snapshots/Pages1.template.json | 12 ++++++++ .../Pages/Snapshots/Pages2.template.json | 12 ++++++++ .../Snapshots/Properties.template.json | 1 + .../ResolvableProperties.template.json | 1 + .../UnresolvableProperties.template.json | 1 + .../Snapshots/NodeTemplateValidateOutput.log | 4 +-- .../Snapshots/Variables.template.json | 1 + 28 files changed, 150 insertions(+), 33 deletions(-) create mode 100644 Tests/Functional/Features/Disabled/DisabledTest.php create mode 100644 Tests/Functional/Features/Disabled/NodeTypes.Disabled.yaml create mode 100644 Tests/Functional/Features/Disabled/Snapshots/Disabled.nodes.json create mode 100644 Tests/Functional/Features/Disabled/Snapshots/Disabled.template.json create mode 100644 Tests/Functional/Features/Disabled/Snapshots/Disabled.yaml diff --git a/Classes/Domain/NodeCreation/NodeCreationService.php b/Classes/Domain/NodeCreation/NodeCreationService.php index 61cf247..cb25400 100644 --- a/Classes/Domain/NodeCreation/NodeCreationService.php +++ b/Classes/Domain/NodeCreation/NodeCreationService.php @@ -53,12 +53,9 @@ public function createMutatorsForRootTemplate(RootTemplate $template, NodeType $ $this->referencesProcessor->processAndValidateReferences($node, $processingErrors) ); - if ($template->getDisabled() === true) { - $node->setHidden(true); - } - return NodeMutatorCollection::from( NodeMutator::setProperties($validProperties), + NodeMutator::setDisabled($template->getDisabled()), $this->createMutatorForUriPathSegment($template->getProperties()), )->merge( $this->createMutatorsForChildNodeTemplates( @@ -71,7 +68,7 @@ public function createMutatorsForRootTemplate(RootTemplate $template, NodeType $ private function createMutatorsForChildNodeTemplates(Templates $templates, TransientNode $parentNode, ProcessingErrors $processingErrors): NodeMutatorCollection { - $nodeMutators = NodeMutatorCollection::empty(); + $nodeMutators = NodeMutatorCollection::createEmpty(); // `hasAutoCreatedChildNode` actually has a bug; it looks up the NodeName parameter against the raw configuration instead of the transliterated NodeName // https://github.com/neos/neos-ui/issues/3527 @@ -157,6 +154,7 @@ private function createMutatorsForChildNodeTemplates(Templates $templates, Trans NodeMutatorCollection::from( NodeMutator::createAndSelectNode($template->getType(), $template->getName()), NodeMutator::setProperties($validProperties), + NodeMutator::setDisabled($template->getDisabled()), $this->createMutatorForUriPathSegment($template->getProperties()) )->merge($this->createMutatorsForChildNodeTemplates( $template->getChildNodes(), @@ -168,10 +166,6 @@ private function createMutatorsForChildNodeTemplates(Templates $templates, Trans } - if ($template->getDisabled() === true) { - $node->setHidden(true); - } - return $nodeMutators; } diff --git a/Classes/Domain/NodeCreation/NodeMutator.php b/Classes/Domain/NodeCreation/NodeMutator.php index 02c5d35..23e4558 100644 --- a/Classes/Domain/NodeCreation/NodeMutator.php +++ b/Classes/Domain/NodeCreation/NodeMutator.php @@ -48,6 +48,19 @@ public static function setProperties(array $properties): self }); } + /** + * Queues to disable the current node. + * + * Preserves the current node pointer. + */ + public static function setDisabled(bool $disabled): self + { + return new self(function (NodeInterface $nodePointer) use ($disabled) { + $nodePointer->setHidden($disabled); + return null; + }); + } + /** * Queues to execute the collection {@see NodeMutatorCollection} on the current node. * Any selections made in the collection {@see self::selectChildNode()} won't change the pointer to $this current node. diff --git a/Classes/Domain/NodeCreation/NodeMutatorCollection.php b/Classes/Domain/NodeCreation/NodeMutatorCollection.php index e5c91b2..0846e34 100644 --- a/Classes/Domain/NodeCreation/NodeMutatorCollection.php +++ b/Classes/Domain/NodeCreation/NodeMutatorCollection.php @@ -29,7 +29,7 @@ public static function from(NodeMutator ...$items): self return new self(...$items); } - public static function empty(): self + public static function createEmpty(): self { return new self(); } diff --git a/Classes/Domain/NodeCreation/PropertiesProcessor.php b/Classes/Domain/NodeCreation/PropertiesProcessor.php index 329d79a..d4dee94 100644 --- a/Classes/Domain/NodeCreation/PropertiesProcessor.php +++ b/Classes/Domain/NodeCreation/PropertiesProcessor.php @@ -95,7 +95,7 @@ private function assertValidPropertyName($propertyName): void if ($propertyName[0] === '_') { $lowerPropertyName = strtolower($propertyName); if ($lowerPropertyName === '_hidden') { - throw new PropertyIgnoredException('Using "_hidden" as property declaration was removed. Please use "disabled" on the first level instead.'); + throw new PropertyIgnoredException('Using "_hidden" as property declaration was removed. Please use "disabled" on the first level instead.', 1719079679); } foreach ($legacyInternalProperties as $legacyInternalProperty) { if ($lowerPropertyName === strtolower($legacyInternalProperty)) { diff --git a/Classes/Domain/Template/RootTemplate.php b/Classes/Domain/Template/RootTemplate.php index 9d07b7c..3bd02cb 100644 --- a/Classes/Domain/Template/RootTemplate.php +++ b/Classes/Domain/Template/RootTemplate.php @@ -12,7 +12,7 @@ */ class RootTemplate implements \JsonSerializable { - private ?bool $disabled; + private bool $disabled; /** * @var array @@ -25,7 +25,7 @@ class RootTemplate implements \JsonSerializable * @internal * @param array $properties */ - public function __construct(?bool $disabled, array $properties, Templates $childNodes) + public function __construct(bool $disabled, array $properties, Templates $childNodes) { $this->disabled = $disabled; $this->properties = $properties; @@ -34,10 +34,10 @@ public function __construct(?bool $disabled, array $properties, Templates $child public static function empty(): self { - return new RootTemplate(null, [], Templates::empty()); + return new RootTemplate(false, [], Templates::empty()); } - public function getDisabled(): ?bool + public function getDisabled(): bool { return $this->disabled; } diff --git a/Classes/Domain/Template/Template.php b/Classes/Domain/Template/Template.php index aa46f2c..4cd5efe 100644 --- a/Classes/Domain/Template/Template.php +++ b/Classes/Domain/Template/Template.php @@ -18,7 +18,7 @@ class Template implements \JsonSerializable private ?NodeName $name; - private ?bool $disabled; + private bool $disabled; /** * @var array @@ -31,7 +31,7 @@ class Template implements \JsonSerializable * @internal * @param array $properties */ - public function __construct(?NodeTypeName $type, ?NodeName $name, ?bool $disabled, array $properties, Templates $childNodes) + public function __construct(?NodeTypeName $type, ?NodeName $name, bool $disabled, array $properties, Templates $childNodes) { $this->type = $type; $this->name = $name; @@ -50,7 +50,7 @@ public function getName(): ?NodeName return $this->name; } - public function getDisabled(): ?bool + public function getDisabled(): bool { return $this->disabled; } diff --git a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php index b87b39e..09610ff 100644 --- a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php +++ b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php @@ -139,7 +139,7 @@ private function createTemplateFromTemplatePart(TemplatePart $templatePart): Tem return new Template( $type !== null ? NodeTypeName::fromString($type) : null, $name !== null ? NodeName::fromString(Utility::renderValidNodeName($name)) : null, - $templatePart->hasConfiguration('disabled') ? (bool)$templatePart->processConfiguration('disabled') : null, + (bool)$templatePart->processConfiguration('disabled'), $processedProperties, $childNodeTemplates ); diff --git a/Tests/Functional/AbstractNodeTemplateTestCase.php b/Tests/Functional/AbstractNodeTemplateTestCase.php index 5690313..941fd68 100644 --- a/Tests/Functional/AbstractNodeTemplateTestCase.php +++ b/Tests/Functional/AbstractNodeTemplateTestCase.php @@ -28,6 +28,8 @@ abstract class AbstractNodeTemplateTestCase extends FunctionalTestCase use WithConfigurationTrait; use FakeNodeTypeManagerTrait; + protected static bool $showDisabledNodesInSubgraph = false; + protected static $testablePersistenceEnabled = true; private ContextFactoryInterface $contextFactory; @@ -44,21 +46,21 @@ abstract class AbstractNodeTemplateTestCase extends FunctionalTestCase private string $fixturesDir; - /** @deprecated please use {@see self::getObject()} instead */ + /** @internal please use {@see self::getObject()} instead */ protected $objectManager; public function setUp(): void { parent::setUp(); - $this->nodeTypeManager = $this->objectManager->get(NodeTypeManager::class); + $this->nodeTypeManager = $this->getObject(NodeTypeManager::class); $this->loadFakeNodeTypes(); $this->setupContentRepository(); - $this->nodeTemplateDumper = $this->objectManager->get(NodeTemplateDumper::class); + $this->nodeTemplateDumper = $this->getObject(NodeTemplateDumper::class); - $templateFactory = $this->objectManager->get(TemplateConfigurationProcessor::class); + $templateFactory = $this->getObject(TemplateConfigurationProcessor::class); $templateFactoryMock = $this->getMockBuilder(TemplateConfigurationProcessor::class)->disableOriginalConstructor()->getMock(); $templateFactoryMock->expects(self::once())->method('processTemplateConfiguration')->willReturnCallback(function (...$args) use($templateFactory) { @@ -76,7 +78,7 @@ public function tearDown(): void { parent::tearDown(); $this->inject($this->contextFactory, 'contextInstances', []); - $this->objectManager->get(FeedbackCollection::class)->reset(); + $this->getObject(FeedbackCollection::class)->reset(); $this->objectManager->forgetInstance(ContentDimensionRepository::class); $this->objectManager->forgetInstance(TemplateConfigurationProcessor::class); $this->objectManager->forgetInstance(NodeTypeManager::class); @@ -96,20 +98,20 @@ final protected function getObject(string $className): object private function setupContentRepository(): void { // Create an environment to create nodes. - $this->objectManager->get(ContentDimensionRepository::class)->setDimensionsConfiguration([]); + $this->getObject(ContentDimensionRepository::class)->setDimensionsConfiguration([]); $liveWorkspace = new Workspace('live'); - $workspaceRepository = $this->objectManager->get(WorkspaceRepository::class); + $workspaceRepository = $this->getObject(WorkspaceRepository::class); $workspaceRepository->add($liveWorkspace); $testSite = new Site('test-site'); $testSite->setSiteResourcesPackageKey('Test.Site'); - $siteRepository = $this->objectManager->get(SiteRepository::class); + $siteRepository = $this->getObject(SiteRepository::class); $siteRepository->add($testSite); $this->persistenceManager->persistAll(); - $this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class); - $subgraph = $this->contextFactory->create(['workspaceName' => 'live']); + $this->contextFactory = $this->getObject(ContextFactoryInterface::class); + $subgraph = $this->contextFactory->create(['workspaceName' => 'live', 'invisibleContentShown' => static::$showDisabledNodesInSubgraph]); $rootNode = $subgraph->getRootNode(); @@ -153,7 +155,11 @@ protected function createNodeInto(NodeInterface $targetNode, string $nodeTypeNam assert($changeCollection instanceof ChangeCollection); $changeCollection->apply(); - return $targetNode->getNode('new-node'); + $newNode = $targetNode->getNode('new-node'); + if (!$newNode) { + throw new \RuntimeException('New node not found at expected location. Try settting $showDisabledNodesInSubgraph.', 1719079419); + } + return $newNode; } protected function createFakeNode(string $nodeAggregateId): NodeInterface diff --git a/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json b/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json index 5b4f019..9f19ca0 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json @@ -1,14 +1,17 @@ { + "disabled": false, "properties": [], "childNodes": [ { "type": null, "name": "content", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "Text" }, diff --git a/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json b/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json index 973a42e..c08358a 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json @@ -1,14 +1,17 @@ { + "disabled": false, "properties": [], "childNodes": [ { "type": null, "name": "column0", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "

foo<\/p>" }, @@ -19,11 +22,13 @@ { "type": null, "name": "column1", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "

bar<\/p>" }, diff --git a/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json b/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json index 14a1692..5fdc2a0 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json @@ -1,14 +1,17 @@ { + "disabled": false, "properties": [], "childNodes": [ { "type": null, "name": "content", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "Text" }, @@ -19,6 +22,7 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": "illegal-node-1", + "disabled": false, "properties": [], "childNodes": [] } diff --git a/Tests/Functional/Features/Disabled/DisabledTest.php b/Tests/Functional/Features/Disabled/DisabledTest.php new file mode 100644 index 0000000..3a89067 --- /dev/null +++ b/Tests/Functional/Features/Disabled/DisabledTest.php @@ -0,0 +1,27 @@ +createNodeInto( + $this->homePageMainContentCollectionNode, + 'Flowpack.NodeTemplates:Content.Disabled', + [] + ); + + $this->assertLastCreatedTemplateMatchesSnapshot('Disabled'); + + $this->assertNoExceptionsWereCaught(); + $this->assertNodeDumpAndTemplateDumpMatchSnapshot('Disabled', $createdNode); + } +} diff --git a/Tests/Functional/Features/Disabled/NodeTypes.Disabled.yaml b/Tests/Functional/Features/Disabled/NodeTypes.Disabled.yaml new file mode 100644 index 0000000..0cd7394 --- /dev/null +++ b/Tests/Functional/Features/Disabled/NodeTypes.Disabled.yaml @@ -0,0 +1,7 @@ + +'Flowpack.NodeTemplates:Content.Disabled': + superTypes: + 'Neos.Neos:Content': true + options: + template: + disabled: true diff --git a/Tests/Functional/Features/Disabled/Snapshots/Disabled.nodes.json b/Tests/Functional/Features/Disabled/Snapshots/Disabled.nodes.json new file mode 100644 index 0000000..d2b4484 --- /dev/null +++ b/Tests/Functional/Features/Disabled/Snapshots/Disabled.nodes.json @@ -0,0 +1,3 @@ +{ + "isDisabled": true +} diff --git a/Tests/Functional/Features/Disabled/Snapshots/Disabled.template.json b/Tests/Functional/Features/Disabled/Snapshots/Disabled.template.json new file mode 100644 index 0000000..0909a16 --- /dev/null +++ b/Tests/Functional/Features/Disabled/Snapshots/Disabled.template.json @@ -0,0 +1,5 @@ +{ + "disabled": true, + "properties": [], + "childNodes": [] +} diff --git a/Tests/Functional/Features/Disabled/Snapshots/Disabled.yaml b/Tests/Functional/Features/Disabled/Snapshots/Disabled.yaml new file mode 100644 index 0000000..f133bb4 --- /dev/null +++ b/Tests/Functional/Features/Disabled/Snapshots/Disabled.yaml @@ -0,0 +1,3 @@ +'{nodeTypeName}': + options: + template: [] diff --git a/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json b/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json index a61e568..8ea2e9c 100644 --- a/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json +++ b/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json @@ -1,4 +1,5 @@ { + "disabled": false, "properties": [], "childNodes": [] } diff --git a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json index 3e23bdd..d9d89e7 100644 --- a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json +++ b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json @@ -52,7 +52,7 @@ "severity": "ERROR" }, { - "message": "Property \"_hidden\" in NodeType \"Flowpack.NodeTemplates:Content.SomeExceptions\" | PropertyIgnoredException(Because internal legacy property \"_hidden\" not implement., 1686149513158)", + "message": "Property \"_hidden\" in NodeType \"Flowpack.NodeTemplates:Content.SomeExceptions\" | PropertyIgnoredException(Using \"_hidden\" as property declaration was removed. Please use \"disabled\" on the first level instead., 1719079679)", "severity": "ERROR" }, { diff --git a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json index 891cc60..20a5901 100644 --- a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json +++ b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json @@ -1,4 +1,5 @@ { + "disabled": false, "properties": { "_hidden": true, "_hiddenAfterDateTime": 123, @@ -15,6 +16,7 @@ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "bar" }, @@ -23,12 +25,14 @@ { "type": "Neos.Neos:Node", "name": null, + "disabled": false, "properties": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:Document.Page", "name": "illegal", + "disabled": false, "properties": { "text": "huhu" }, @@ -37,6 +41,7 @@ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "123" }, @@ -45,6 +50,7 @@ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "foo" }, @@ -53,18 +59,21 @@ { "type": null, "name": null, + "disabled": false, "properties": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:InvalidNodeType", "name": null, + "disabled": false, "properties": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:Content.SomeExceptions", "name": "type-cant-mutate", + "disabled": false, "properties": [], "childNodes": [] } diff --git a/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json b/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json index f10add1..c8e56da 100644 --- a/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json +++ b/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json @@ -1,14 +1,17 @@ { + "disabled": false, "properties": [], "childNodes": [ { "type": null, "name": "container", + "disabled": false, "properties": [], "childNodes": [ { "type": null, "name": "text", + "disabled": false, "properties": { "text": "nested text" }, diff --git a/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json b/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json index e7320bc..2893345 100644 --- a/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json +++ b/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json @@ -1,9 +1,11 @@ { + "disabled": false, "properties": [], "childNodes": [ { "type": null, "name": "my-node", + "disabled": false, "properties": { "text": "legalNodeName" }, @@ -12,6 +14,7 @@ { "type": null, "name": "foobar", + "disabled": false, "properties": { "text": "capitalsInName" }, @@ -20,6 +23,7 @@ { "type": null, "name": "o", + "disabled": false, "properties": { "text": "\u00f6 - was soll das" }, @@ -28,6 +32,7 @@ { "type": null, "name": "ablabei-jing-ss-ha", + "disabled": false, "properties": { "text": "everythingMixedTogether" }, @@ -36,6 +41,7 @@ { "type": null, "name": "node-d41d8cd98f00b204e9800998ecf8427e", + "disabled": false, "properties": { "text": "emptyString" }, diff --git a/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json b/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json index 37cee55..e585452 100644 --- a/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json +++ b/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json @@ -1,4 +1,5 @@ { + "disabled": false, "properties": { "title": "Page1", "uriPathSegment": "page1" @@ -7,11 +8,13 @@ { "type": null, "name": "main", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "textOnPage1" }, @@ -22,6 +25,7 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, + "disabled": false, "properties": { "title": "Page2", "uriPathSegment": "page2" @@ -30,11 +34,13 @@ { "type": null, "name": "main", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "textOnPage2" }, @@ -45,6 +51,7 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, + "disabled": false, "properties": { "title": "Page3", "uriPathSegment": "page3" @@ -53,11 +60,13 @@ { "type": null, "name": "main", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "textOnPage3" }, @@ -72,6 +81,7 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, + "disabled": false, "properties": { "title": "Page4", "uriPathSegment": "page4" @@ -80,11 +90,13 @@ { "type": null, "name": "main", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "textOnPage4" }, diff --git a/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json b/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json index a2517ab..5ec99f7 100644 --- a/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json +++ b/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json @@ -1,14 +1,17 @@ { + "disabled": false, "properties": [], "childNodes": [ { "type": null, "name": "main", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "textOnPage1" }, @@ -19,6 +22,7 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, + "disabled": false, "properties": { "title": "Page2" }, @@ -26,11 +30,13 @@ { "type": null, "name": "main", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "textOnPage2" }, @@ -41,6 +47,7 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, + "disabled": false, "properties": { "title": "Page3", "uriPathSegment": "page3" @@ -49,11 +56,13 @@ { "type": null, "name": "main", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "textOnPage3" }, @@ -68,6 +77,7 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, + "disabled": false, "properties": { "title": "Page4" }, @@ -75,11 +85,13 @@ { "type": null, "name": "main", + "disabled": false, "properties": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, + "disabled": false, "properties": { "text": "textOnPage4" }, diff --git a/Tests/Functional/Features/Properties/Snapshots/Properties.template.json b/Tests/Functional/Features/Properties/Snapshots/Properties.template.json index 81c8297..c17d496 100644 --- a/Tests/Functional/Features/Properties/Snapshots/Properties.template.json +++ b/Tests/Functional/Features/Properties/Snapshots/Properties.template.json @@ -1,4 +1,5 @@ { + "disabled": false, "properties": { "text": "abc", "isEnchanted": false, diff --git a/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json b/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json index 7b462df..c92a5af 100644 --- a/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json +++ b/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json @@ -1,4 +1,5 @@ { + "disabled": false, "properties": { "asset": "c228200e-7472-4290-9936-4454a5b5692a", "reference": "some-node-id", diff --git a/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json b/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json index 0921e0b..816ae2c 100644 --- a/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json +++ b/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json @@ -1,4 +1,5 @@ { + "disabled": false, "properties": { "someString": [ "foo" diff --git a/Tests/Functional/Features/StandaloneValidationCommand/Snapshots/NodeTemplateValidateOutput.log b/Tests/Functional/Features/StandaloneValidationCommand/Snapshots/NodeTemplateValidateOutput.log index e4e0f03..a516b2c 100644 --- a/Tests/Functional/Features/StandaloneValidationCommand/Snapshots/NodeTemplateValidateOutput.log +++ b/Tests/Functional/Features/StandaloneValidationCommand/Snapshots/NodeTemplateValidateOutput.log @@ -1,4 +1,4 @@ -10 of 15 NodeType template validated. 5 could not be build standalone. +11 of 16 NodeType template validated. 5 could not be build standalone. Flowpack.NodeTemplates:Content.DisallowedChildNodes NodeConstraintException(Node type "Flowpack.NodeTemplates:Content.Text" is not allowed below tethered child nodes "content" of nodes of type "Flowpack.NodeTemplates:Content.DisallowedChildNodes", 1687541480146) @@ -42,7 +42,7 @@ Flowpack.NodeTemplates:Content.SomeExceptions Configuration "childNodes.invalidOption.crazy" | InvalidArgumentException(Template configuration has illegal key "crazy", 1686150349274) - Property "_hidden" in NodeType "Flowpack.NodeTemplates:Content.SomeExceptions" | PropertyIgnoredException(Because internal legacy property "_hidden" not implement., 1686149513158) + Property "_hidden" in NodeType "Flowpack.NodeTemplates:Content.SomeExceptions" | PropertyIgnoredException(Using "_hidden" as property declaration was removed. Please use "disabled" on the first level instead., 1719079679) Property "_hiddenAfterDateTime" in NodeType "Flowpack.NodeTemplates:Content.SomeExceptions" | PropertyIgnoredException(Because internal legacy property "_hiddenAfterDateTime" not implement., 1686149513158) diff --git a/Tests/Functional/Features/Variables/Snapshots/Variables.template.json b/Tests/Functional/Features/Variables/Snapshots/Variables.template.json index 3602f63..8ae697d 100644 --- a/Tests/Functional/Features/Variables/Snapshots/Variables.template.json +++ b/Tests/Functional/Features/Variables/Snapshots/Variables.template.json @@ -1,4 +1,5 @@ { + "disabled": false, "properties": { "text": "parentNode(Neos.Neos:ContentCollection, main) site(unstructured, test-site)" }, From 4f8e5f17280708bb061059ea47e7a82995bf266d Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 29 Jun 2024 11:55:41 +0200 Subject: [PATCH 3/3] FEATURE: Introduce forward compatible syntax to set Neos 9 Node subtree tags and allow `tags.disabled` in Neos 8.3 --- .../NodeCreation/NodeCreationService.php | 4 +- .../NodeCreation/PropertiesProcessor.php | 2 +- Classes/Domain/Template/RootTemplate.php | 22 ++++---- Classes/Domain/Template/SubtreeTags.php | 53 +++++++++++++++++++ Classes/Domain/Template/Template.php | 20 +++---- Classes/Domain/Template/Templates.php | 2 +- .../TemplateConfigurationProcessor.php | 27 +++++++++- .../TemplateConfiguration/TemplatePart.php | 4 +- README.md | 9 +++- .../Snapshots/AllowedChildNodes.template.json | 6 +-- .../Snapshots/ChildNodes.template.json | 10 ++-- .../DisallowedChildNodes.template.json | 8 +-- .../Features/Disabled/NodeTypes.Disabled.yaml | 7 --- .../Disabled/Snapshots/Disabled.nodes.json | 3 -- .../DisabledTagTest.php} | 12 ++--- .../DisabledTag/NodeTypes.Disabled.yaml | 8 +++ .../Snapshots/DisabledTag.nodes.json | 5 ++ .../Snapshots/DisabledTag.template.json} | 4 +- .../Snapshots/DisabledTag.yaml} | 0 .../Snapshots/OnlyExceptions.template.json | 2 +- .../Snapshots/SomeExceptions.messages.json | 2 +- .../Snapshots/SomeExceptions.template.json | 18 +++---- .../Snapshots/NestedNodeNames.template.json | 6 +-- .../Snapshots/NodeNames.template.json | 12 ++--- .../Pages/Snapshots/Pages1.template.json | 24 ++++----- .../Pages/Snapshots/Pages2.template.json | 24 ++++----- .../Snapshots/Properties.template.json | 2 +- .../ResolvableProperties.template.json | 2 +- .../UnresolvableProperties.template.json | 2 +- .../Snapshots/NodeTemplateValidateOutput.log | 2 +- .../Snapshots/Variables.template.json | 2 +- .../Functional/JsonSerializeNodeTreeTrait.php | 2 +- 32 files changed, 197 insertions(+), 109 deletions(-) create mode 100644 Classes/Domain/Template/SubtreeTags.php delete mode 100644 Tests/Functional/Features/Disabled/NodeTypes.Disabled.yaml delete mode 100644 Tests/Functional/Features/Disabled/Snapshots/Disabled.nodes.json rename Tests/Functional/Features/{Disabled/DisabledTest.php => DisabledTag/DisabledTagTest.php} (79%) create mode 100644 Tests/Functional/Features/DisabledTag/NodeTypes.Disabled.yaml create mode 100644 Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.nodes.json rename Tests/Functional/Features/{Disabled/Snapshots/Disabled.template.json => DisabledTag/Snapshots/DisabledTag.template.json} (54%) rename Tests/Functional/Features/{Disabled/Snapshots/Disabled.yaml => DisabledTag/Snapshots/DisabledTag.yaml} (100%) diff --git a/Classes/Domain/NodeCreation/NodeCreationService.php b/Classes/Domain/NodeCreation/NodeCreationService.php index cb25400..9ea4d5c 100644 --- a/Classes/Domain/NodeCreation/NodeCreationService.php +++ b/Classes/Domain/NodeCreation/NodeCreationService.php @@ -55,7 +55,7 @@ public function createMutatorsForRootTemplate(RootTemplate $template, NodeType $ return NodeMutatorCollection::from( NodeMutator::setProperties($validProperties), - NodeMutator::setDisabled($template->getDisabled()), + NodeMutator::setDisabled($template->getTags()->isDisabled()), $this->createMutatorForUriPathSegment($template->getProperties()), )->merge( $this->createMutatorsForChildNodeTemplates( @@ -154,7 +154,7 @@ private function createMutatorsForChildNodeTemplates(Templates $templates, Trans NodeMutatorCollection::from( NodeMutator::createAndSelectNode($template->getType(), $template->getName()), NodeMutator::setProperties($validProperties), - NodeMutator::setDisabled($template->getDisabled()), + NodeMutator::setDisabled($template->getTags()->isDisabled()), $this->createMutatorForUriPathSegment($template->getProperties()) )->merge($this->createMutatorsForChildNodeTemplates( $template->getChildNodes(), diff --git a/Classes/Domain/NodeCreation/PropertiesProcessor.php b/Classes/Domain/NodeCreation/PropertiesProcessor.php index d4dee94..e144422 100644 --- a/Classes/Domain/NodeCreation/PropertiesProcessor.php +++ b/Classes/Domain/NodeCreation/PropertiesProcessor.php @@ -95,7 +95,7 @@ private function assertValidPropertyName($propertyName): void if ($propertyName[0] === '_') { $lowerPropertyName = strtolower($propertyName); if ($lowerPropertyName === '_hidden') { - throw new PropertyIgnoredException('Using "_hidden" as property declaration was removed. Please use "disabled" on the first level instead.', 1719079679); + throw new PropertyIgnoredException('Using "_hidden" as property declaration was removed. Please use "tags.disabled" instead.', 1719079679); } foreach ($legacyInternalProperties as $legacyInternalProperty) { if ($lowerPropertyName === strtolower($legacyInternalProperty)) { diff --git a/Classes/Domain/Template/RootTemplate.php b/Classes/Domain/Template/RootTemplate.php index 3bd02cb..e619621 100644 --- a/Classes/Domain/Template/RootTemplate.php +++ b/Classes/Domain/Template/RootTemplate.php @@ -12,34 +12,29 @@ */ class RootTemplate implements \JsonSerializable { - private bool $disabled; - /** * @var array */ private array $properties; + private SubtreeTags $tags; + private Templates $childNodes; /** * @internal * @param array $properties */ - public function __construct(bool $disabled, array $properties, Templates $childNodes) + public function __construct(array $properties, SubtreeTags $tags, Templates $childNodes) { - $this->disabled = $disabled; $this->properties = $properties; + $this->tags = $tags; $this->childNodes = $childNodes; } public static function empty(): self { - return new RootTemplate(false, [], Templates::empty()); - } - - public function getDisabled(): bool - { - return $this->disabled; + return new RootTemplate([], SubtreeTags::createEmpty(), Templates::empty()); } /** @@ -50,6 +45,11 @@ public function getProperties(): array return $this->properties; } + public function getTags(): SubtreeTags + { + return $this->tags; + } + public function getChildNodes(): Templates { return $this->childNodes; @@ -58,8 +58,8 @@ public function getChildNodes(): Templates public function jsonSerialize(): array { return [ - 'disabled' => $this->disabled, 'properties' => $this->properties, + 'tags' => $this->tags, 'childNodes' => $this->childNodes ]; } diff --git a/Classes/Domain/Template/SubtreeTags.php b/Classes/Domain/Template/SubtreeTags.php new file mode 100644 index 0000000..4f44261 --- /dev/null +++ b/Classes/Domain/Template/SubtreeTags.php @@ -0,0 +1,53 @@ +isDisabled = $isDisabled; + } + + public static function createEmpty(): self + { + return new self(false); + } + + public static function createDisabled(): self + { + return new self(true); + } + + public function isDisabled(): bool + { + return $this->isDisabled; + } + + public function jsonSerialize(): array + { + return $this->isDisabled ? ['disabled'] : []; + } +} diff --git a/Classes/Domain/Template/Template.php b/Classes/Domain/Template/Template.php index 4cd5efe..b4e158c 100644 --- a/Classes/Domain/Template/Template.php +++ b/Classes/Domain/Template/Template.php @@ -18,25 +18,25 @@ class Template implements \JsonSerializable private ?NodeName $name; - private bool $disabled; - /** * @var array */ private array $properties; + private SubtreeTags $tags; + private Templates $childNodes; /** * @internal * @param array $properties */ - public function __construct(?NodeTypeName $type, ?NodeName $name, bool $disabled, array $properties, Templates $childNodes) + public function __construct(?NodeTypeName $type, ?NodeName $name, array $properties, SubtreeTags $tags, Templates $childNodes) { $this->type = $type; $this->name = $name; - $this->disabled = $disabled; $this->properties = $properties; + $this->tags = $tags; $this->childNodes = $childNodes; } @@ -50,11 +50,6 @@ public function getName(): ?NodeName return $this->name; } - public function getDisabled(): bool - { - return $this->disabled; - } - /** * @return array */ @@ -63,6 +58,11 @@ public function getProperties(): array return $this->properties; } + public function getTags(): SubtreeTags + { + return $this->tags; + } + public function getChildNodes(): Templates { return $this->childNodes; @@ -73,8 +73,8 @@ public function jsonSerialize(): array return [ 'type' => $this->type, 'name' => $this->name, - 'disabled' => $this->disabled, 'properties' => $this->properties, + 'tags' => $this->tags, 'childNodes' => $this->childNodes ]; } diff --git a/Classes/Domain/Template/Templates.php b/Classes/Domain/Template/Templates.php index b7b65f6..331fc4e 100644 --- a/Classes/Domain/Template/Templates.php +++ b/Classes/Domain/Template/Templates.php @@ -50,8 +50,8 @@ public function toRootTemplate(): RootTemplate } foreach ($this->items as $first) { return new RootTemplate( - $first->getDisabled(), $first->getProperties(), + $first->getTags(), $first->getChildNodes() ); } diff --git a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php index 09610ff..0e897e4 100644 --- a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php +++ b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php @@ -4,6 +4,7 @@ use Flowpack\NodeTemplates\Domain\ErrorHandling\ProcessingErrors; use Flowpack\NodeTemplates\Domain\Template\RootTemplate; +use Flowpack\NodeTemplates\Domain\Template\SubtreeTags; use Flowpack\NodeTemplates\Domain\Template\Template; use Flowpack\NodeTemplates\Domain\Template\Templates; use Neos\ContentRepository\Domain\NodeAggregate\NodeName; @@ -119,6 +120,30 @@ private function createTemplateFromTemplatePart(TemplatePart $templatePart): Tem } } + // process the tags (in Neos 8.3 only tags.disabled is allowed) + $isDisabled = false; + foreach ($templatePart->getRawConfiguration('tags') ?? [] as $tagName => $value) { + if (!is_string($value) && !is_bool($value) && !is_null($value)) { + $templatePart->addProcessingErrorForPath( + new \RuntimeException(sprintf('Template configuration tags can only hold string|bool|null. Tag "%s" has type "%s"', $tagName, gettype($value)), 1719653856), + ['tags', $tagName] + ); + continue; + } + if ($tagName !== 'disabled') { + $templatePart->addProcessingErrorForPath( + new \RuntimeException('Template configuration only allows "disabled" tag to hide Nodes in Neos 8.3', 1719653919), + ['tags', $tagName] + ); + continue; + } + try { + $isDisabled = $templatePart->processConfiguration(['tags', 'disabled']); + } catch (StopBuildingTemplatePartException $e) { + } + } + $processedTags = $isDisabled === true ? SubtreeTags::createDisabled() : SubtreeTags::createEmpty(); + // process the childNodes $childNodeTemplates = Templates::empty(); foreach ($templatePart->getRawConfiguration('childNodes') ?? [] as $childNodeConfigurationPath => $childNodeConfiguration) { @@ -139,8 +164,8 @@ private function createTemplateFromTemplatePart(TemplatePart $templatePart): Tem return new Template( $type !== null ? NodeTypeName::fromString($type) : null, $name !== null ? NodeName::fromString(Utility::renderValidNodeName($name)) : null, - (bool)$templatePart->processConfiguration('disabled'), $processedProperties, + $processedTags, $childNodeTemplates ); } diff --git a/Classes/Domain/TemplateConfiguration/TemplatePart.php b/Classes/Domain/TemplateConfiguration/TemplatePart.php index 9ba8e16..239eccc 100644 --- a/Classes/Domain/TemplateConfiguration/TemplatePart.php +++ b/Classes/Domain/TemplateConfiguration/TemplatePart.php @@ -210,7 +210,7 @@ private function validateTemplateConfigurationKeys(): void { $isRootTemplate = $this->fullPathToConfiguration === []; foreach (array_keys($this->configuration) as $key) { - if (!in_array($key, ['type', 'name', 'disabled', 'properties', 'childNodes', 'when', 'withItems', 'withContext'], true)) { + if (!in_array($key, ['type', 'name', 'properties', 'tags', 'childNodes', 'when', 'withItems', 'withContext'], true)) { $this->addProcessingErrorForPath( new \InvalidArgumentException(sprintf('Template configuration has illegal key "%s"', $key), 1686150349274), $key @@ -218,7 +218,7 @@ private function validateTemplateConfigurationKeys(): void throw new StopBuildingTemplatePartException(); } if ($isRootTemplate) { - if (!in_array($key, ['disabled', 'properties', 'childNodes', 'when', 'withContext'], true)) { + if (!in_array($key, ['properties', 'tags', 'childNodes', 'when', 'withContext'], true)) { $this->addProcessingErrorForPath( new \InvalidArgumentException(sprintf('Root template configuration doesnt allow option "%s', $key), 1686150340657), $key diff --git a/README.md b/README.md index b221f56..87d5926 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,11 @@ The following example creates three different text child nodes in the main conte We call conditions ``when`` and loops ``withItems`` (instead of ``if`` and ``forEach``), because it inspires a more declarative mood. The naming is inspired by Ansible. -## Disable nodes (in version 1.0 "_hidden") +## Disable / Hide nodes (`tags.disabled`) +> In version 1.0 available via the magic property `"_hidden"` + +To disable a node one can set the `"disabled"` tag to `true`. Either explicitly or by the result of an EEL expression. +> Note that other custom tags are not supported by Neos 8.3 but will be with Neos 9.0 The following example disables a newly created node: @@ -163,7 +167,8 @@ The following example disables a newly created node: 'Neos.NodeTypes:Page': options: template: - disabled: true + tags: + disabled: true ``` ## EEL context variables diff --git a/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json b/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json index 9f19ca0..5bd54e2 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json @@ -1,20 +1,20 @@ { - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "content", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "Text" }, + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json b/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json index c08358a..102b671 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json @@ -1,20 +1,20 @@ { - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "column0", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "

foo<\/p>" }, + "tags": [], "childNodes": [] } ] @@ -22,16 +22,16 @@ { "type": null, "name": "column1", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "

bar<\/p>" }, + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json b/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json index 5fdc2a0..0084b37 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json @@ -1,20 +1,20 @@ { - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "content", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "Text" }, + "tags": [], "childNodes": [] } ] @@ -22,8 +22,8 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": "illegal-node-1", - "disabled": false, "properties": [], + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/Disabled/NodeTypes.Disabled.yaml b/Tests/Functional/Features/Disabled/NodeTypes.Disabled.yaml deleted file mode 100644 index 0cd7394..0000000 --- a/Tests/Functional/Features/Disabled/NodeTypes.Disabled.yaml +++ /dev/null @@ -1,7 +0,0 @@ - -'Flowpack.NodeTemplates:Content.Disabled': - superTypes: - 'Neos.Neos:Content': true - options: - template: - disabled: true diff --git a/Tests/Functional/Features/Disabled/Snapshots/Disabled.nodes.json b/Tests/Functional/Features/Disabled/Snapshots/Disabled.nodes.json deleted file mode 100644 index d2b4484..0000000 --- a/Tests/Functional/Features/Disabled/Snapshots/Disabled.nodes.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "isDisabled": true -} diff --git a/Tests/Functional/Features/Disabled/DisabledTest.php b/Tests/Functional/Features/DisabledTag/DisabledTagTest.php similarity index 79% rename from Tests/Functional/Features/Disabled/DisabledTest.php rename to Tests/Functional/Features/DisabledTag/DisabledTagTest.php index 3a89067..a8abf91 100644 --- a/Tests/Functional/Features/Disabled/DisabledTest.php +++ b/Tests/Functional/Features/DisabledTag/DisabledTagTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Flowpack\NodeTemplates\Tests\Functional\Features\Disabled; +namespace Flowpack\NodeTemplates\Tests\Functional\Features\DisabledTag; use Flowpack\NodeTemplates\Tests\Functional\AbstractNodeTemplateTestCase; -class DisabledTest extends AbstractNodeTemplateTestCase +class DisabledTagTest extends AbstractNodeTemplateTestCase { protected static bool $showDisabledNodesInSubgraph = true; @@ -15,13 +15,13 @@ public function itMatchesSnapshot1(): void { $createdNode = $this->createNodeInto( $this->homePageMainContentCollectionNode, - 'Flowpack.NodeTemplates:Content.Disabled', + 'Flowpack.NodeTemplates:Content.DisabledTag', [] ); - $this->assertLastCreatedTemplateMatchesSnapshot('Disabled'); - $this->assertNoExceptionsWereCaught(); - $this->assertNodeDumpAndTemplateDumpMatchSnapshot('Disabled', $createdNode); + + $this->assertLastCreatedTemplateMatchesSnapshot('DisabledTag'); + $this->assertNodeDumpAndTemplateDumpMatchSnapshot('DisabledTag', $createdNode); } } diff --git a/Tests/Functional/Features/DisabledTag/NodeTypes.Disabled.yaml b/Tests/Functional/Features/DisabledTag/NodeTypes.Disabled.yaml new file mode 100644 index 0000000..f8fd7c3 --- /dev/null +++ b/Tests/Functional/Features/DisabledTag/NodeTypes.Disabled.yaml @@ -0,0 +1,8 @@ + +'Flowpack.NodeTemplates:Content.DisabledTag': + superTypes: + 'Neos.Neos:Content': true + options: + template: + tags: + disabled: true diff --git a/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.nodes.json b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.nodes.json new file mode 100644 index 0000000..7921cb8 --- /dev/null +++ b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.nodes.json @@ -0,0 +1,5 @@ +{ + "tags": [ + "disabled" + ] +} diff --git a/Tests/Functional/Features/Disabled/Snapshots/Disabled.template.json b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.template.json similarity index 54% rename from Tests/Functional/Features/Disabled/Snapshots/Disabled.template.json rename to Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.template.json index 0909a16..bef5c10 100644 --- a/Tests/Functional/Features/Disabled/Snapshots/Disabled.template.json +++ b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.template.json @@ -1,5 +1,7 @@ { - "disabled": true, "properties": [], + "tags": [ + "disabled" + ], "childNodes": [] } diff --git a/Tests/Functional/Features/Disabled/Snapshots/Disabled.yaml b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.yaml similarity index 100% rename from Tests/Functional/Features/Disabled/Snapshots/Disabled.yaml rename to Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.yaml diff --git a/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json b/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json index 8ea2e9c..9f4cfc5 100644 --- a/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json +++ b/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json @@ -1,5 +1,5 @@ { - "disabled": false, "properties": [], + "tags": [], "childNodes": [] } diff --git a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json index d9d89e7..d72d175 100644 --- a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json +++ b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json @@ -52,7 +52,7 @@ "severity": "ERROR" }, { - "message": "Property \"_hidden\" in NodeType \"Flowpack.NodeTemplates:Content.SomeExceptions\" | PropertyIgnoredException(Using \"_hidden\" as property declaration was removed. Please use \"disabled\" on the first level instead., 1719079679)", + "message": "Property \"_hidden\" in NodeType \"Flowpack.NodeTemplates:Content.SomeExceptions\" | PropertyIgnoredException(Using \"_hidden\" as property declaration was removed. Please use \"tags.disabled\" instead., 1719079679)", "severity": "ERROR" }, { diff --git a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json index 20a5901..f30099a 100644 --- a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json +++ b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json @@ -1,5 +1,4 @@ { - "disabled": false, "properties": { "_hidden": true, "_hiddenAfterDateTime": 123, @@ -12,69 +11,70 @@ "working": "working", "nonDeclaredProperty": "hi" }, + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "bar" }, + "tags": [], "childNodes": [] }, { "type": "Neos.Neos:Node", "name": null, - "disabled": false, "properties": [], + "tags": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:Document.Page", "name": "illegal", - "disabled": false, "properties": { "text": "huhu" }, + "tags": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "123" }, + "tags": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "foo" }, + "tags": [], "childNodes": [] }, { "type": null, "name": null, - "disabled": false, "properties": [], + "tags": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:InvalidNodeType", "name": null, - "disabled": false, "properties": [], + "tags": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:Content.SomeExceptions", "name": "type-cant-mutate", - "disabled": false, "properties": [], + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json b/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json index c8e56da..2f0ce2f 100644 --- a/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json +++ b/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json @@ -1,20 +1,20 @@ { - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "container", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "text", - "disabled": false, "properties": { "text": "nested text" }, + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json b/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json index 2893345..3f8c34b 100644 --- a/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json +++ b/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json @@ -1,50 +1,50 @@ { - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "my-node", - "disabled": false, "properties": { "text": "legalNodeName" }, + "tags": [], "childNodes": [] }, { "type": null, "name": "foobar", - "disabled": false, "properties": { "text": "capitalsInName" }, + "tags": [], "childNodes": [] }, { "type": null, "name": "o", - "disabled": false, "properties": { "text": "\u00f6 - was soll das" }, + "tags": [], "childNodes": [] }, { "type": null, "name": "ablabei-jing-ss-ha", - "disabled": false, "properties": { "text": "everythingMixedTogether" }, + "tags": [], "childNodes": [] }, { "type": null, "name": "node-d41d8cd98f00b204e9800998ecf8427e", - "disabled": false, "properties": { "text": "emptyString" }, + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json b/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json index e585452..86def1e 100644 --- a/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json +++ b/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json @@ -1,23 +1,23 @@ { - "disabled": false, "properties": { "title": "Page1", "uriPathSegment": "page1" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "textOnPage1" }, + "tags": [], "childNodes": [] } ] @@ -25,25 +25,25 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, - "disabled": false, "properties": { "title": "Page2", "uriPathSegment": "page2" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "textOnPage2" }, + "tags": [], "childNodes": [] } ] @@ -51,25 +51,25 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, - "disabled": false, "properties": { "title": "Page3", "uriPathSegment": "page3" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "textOnPage3" }, + "tags": [], "childNodes": [] } ] @@ -81,25 +81,25 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, - "disabled": false, "properties": { "title": "Page4", "uriPathSegment": "page4" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "textOnPage4" }, + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json b/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json index 5ec99f7..67a4c2f 100644 --- a/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json +++ b/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json @@ -1,20 +1,20 @@ { - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "main", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "textOnPage1" }, + "tags": [], "childNodes": [] } ] @@ -22,24 +22,24 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, - "disabled": false, "properties": { "title": "Page2" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "textOnPage2" }, + "tags": [], "childNodes": [] } ] @@ -47,25 +47,25 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, - "disabled": false, "properties": { "title": "Page3", "uriPathSegment": "page3" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "textOnPage3" }, + "tags": [], "childNodes": [] } ] @@ -77,24 +77,24 @@ { "type": "Flowpack.NodeTemplates:Document.Page", "name": null, - "disabled": false, "properties": { "title": "Page4" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", - "disabled": false, "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", "name": null, - "disabled": false, "properties": { "text": "textOnPage4" }, + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/Properties/Snapshots/Properties.template.json b/Tests/Functional/Features/Properties/Snapshots/Properties.template.json index c17d496..bcd425d 100644 --- a/Tests/Functional/Features/Properties/Snapshots/Properties.template.json +++ b/Tests/Functional/Features/Properties/Snapshots/Properties.template.json @@ -1,5 +1,4 @@ { - "disabled": false, "properties": { "text": "abc", "isEnchanted": false, @@ -8,5 +7,6 @@ "nullValue": null, "unsetValueWithDefault": null }, + "tags": [], "childNodes": [] } diff --git a/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json b/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json index c92a5af..1053333 100644 --- a/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json +++ b/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json @@ -1,5 +1,4 @@ { - "disabled": false, "properties": { "asset": "c228200e-7472-4290-9936-4454a5b5692a", "reference": "some-node-id", @@ -12,5 +11,6 @@ "c8ae9f9f-dd11-4373-bf42-4bf31ec5bd19" ] }, + "tags": [], "childNodes": [] } diff --git a/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json b/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json index 816ae2c..9164be1 100644 --- a/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json +++ b/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json @@ -1,5 +1,4 @@ { - "disabled": false, "properties": { "someString": [ "foo" @@ -13,5 +12,6 @@ "non-existing" ] }, + "tags": [], "childNodes": [] } diff --git a/Tests/Functional/Features/StandaloneValidationCommand/Snapshots/NodeTemplateValidateOutput.log b/Tests/Functional/Features/StandaloneValidationCommand/Snapshots/NodeTemplateValidateOutput.log index a516b2c..7e828ad 100644 --- a/Tests/Functional/Features/StandaloneValidationCommand/Snapshots/NodeTemplateValidateOutput.log +++ b/Tests/Functional/Features/StandaloneValidationCommand/Snapshots/NodeTemplateValidateOutput.log @@ -42,7 +42,7 @@ Flowpack.NodeTemplates:Content.SomeExceptions Configuration "childNodes.invalidOption.crazy" | InvalidArgumentException(Template configuration has illegal key "crazy", 1686150349274) - Property "_hidden" in NodeType "Flowpack.NodeTemplates:Content.SomeExceptions" | PropertyIgnoredException(Using "_hidden" as property declaration was removed. Please use "disabled" on the first level instead., 1719079679) + Property "_hidden" in NodeType "Flowpack.NodeTemplates:Content.SomeExceptions" | PropertyIgnoredException(Using "_hidden" as property declaration was removed. Please use "tags.disabled" instead., 1719079679) Property "_hiddenAfterDateTime" in NodeType "Flowpack.NodeTemplates:Content.SomeExceptions" | PropertyIgnoredException(Because internal legacy property "_hiddenAfterDateTime" not implement., 1686149513158) diff --git a/Tests/Functional/Features/Variables/Snapshots/Variables.template.json b/Tests/Functional/Features/Variables/Snapshots/Variables.template.json index 8ae697d..caa35d1 100644 --- a/Tests/Functional/Features/Variables/Snapshots/Variables.template.json +++ b/Tests/Functional/Features/Variables/Snapshots/Variables.template.json @@ -1,7 +1,7 @@ { - "disabled": false, "properties": { "text": "parentNode(Neos.Neos:ContentCollection, main) site(unstructured, test-site)" }, + "tags": [], "childNodes": [] } diff --git a/Tests/Functional/JsonSerializeNodeTreeTrait.php b/Tests/Functional/JsonSerializeNodeTreeTrait.php index 6cfa74d..e2055ea 100644 --- a/Tests/Functional/JsonSerializeNodeTreeTrait.php +++ b/Tests/Functional/JsonSerializeNodeTreeTrait.php @@ -29,8 +29,8 @@ private function jsonSerializeNodeAndDescendents(NodeInterface $node): array return array_filter([ 'nodeTypeName' => $node->getNodeType()->getName(), 'nodeName' => $node->isAutoCreated() ? $node->getName() : null, - 'isDisabled' => $node->isHidden(), 'properties' => $this->serializeValuesInArray($properties), + 'tags' => $node->isHidden() ? ['disabled'] : [], 'references' => $this->serializeValuesInArray($references), 'childNodes' => array_map( fn ($node) => $this->jsonSerializeNodeAndDescendents($node),