diff --git a/Classes/Domain/NodeCreation/NodeCreationService.php b/Classes/Domain/NodeCreation/NodeCreationService.php index d6dd160..9ea4d5c 100644 --- a/Classes/Domain/NodeCreation/NodeCreationService.php +++ b/Classes/Domain/NodeCreation/NodeCreationService.php @@ -55,6 +55,7 @@ public function createMutatorsForRootTemplate(RootTemplate $template, NodeType $ return NodeMutatorCollection::from( NodeMutator::setProperties($validProperties), + NodeMutator::setDisabled($template->getTags()->isDisabled()), $this->createMutatorForUriPathSegment($template->getProperties()), )->merge( $this->createMutatorsForChildNodeTemplates( @@ -67,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 @@ -153,6 +154,7 @@ private function createMutatorsForChildNodeTemplates(Templates $templates, Trans NodeMutatorCollection::from( NodeMutator::createAndSelectNode($template->getType(), $template->getName()), NodeMutator::setProperties($validProperties), + NodeMutator::setDisabled($template->getTags()->isDisabled()), $this->createMutatorForUriPathSegment($template->getProperties()) )->merge($this->createMutatorsForChildNodeTemplates( $template->getChildNodes(), 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 0c1f17a..e144422 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 "tags.disabled" instead.', 1719079679); + } 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..e619621 100644 --- a/Classes/Domain/Template/RootTemplate.php +++ b/Classes/Domain/Template/RootTemplate.php @@ -17,21 +17,24 @@ class RootTemplate implements \JsonSerializable */ private array $properties; + private SubtreeTags $tags; + private Templates $childNodes; /** * @internal * @param array $properties */ - public function __construct(array $properties, Templates $childNodes) + public function __construct(array $properties, SubtreeTags $tags, Templates $childNodes) { $this->properties = $properties; + $this->tags = $tags; $this->childNodes = $childNodes; } public static function empty(): self { - return new RootTemplate([], Templates::empty()); + return new RootTemplate([], SubtreeTags::createEmpty(), Templates::empty()); } /** @@ -42,6 +45,11 @@ public function getProperties(): array return $this->properties; } + public function getTags(): SubtreeTags + { + return $this->tags; + } + public function getChildNodes(): Templates { return $this->childNodes; @@ -51,6 +59,7 @@ public function jsonSerialize(): array { return [ '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 c8f98ef..b4e158c 100644 --- a/Classes/Domain/Template/Template.php +++ b/Classes/Domain/Template/Template.php @@ -23,17 +23,20 @@ class Template implements \JsonSerializable */ private array $properties; + private SubtreeTags $tags; + private Templates $childNodes; /** * @internal * @param array $properties */ - public function __construct(?NodeTypeName $type, ?NodeName $name, array $properties, Templates $childNodes) + public function __construct(?NodeTypeName $type, ?NodeName $name, array $properties, SubtreeTags $tags, Templates $childNodes) { $this->type = $type; $this->name = $name; $this->properties = $properties; + $this->tags = $tags; $this->childNodes = $childNodes; } @@ -55,6 +58,11 @@ public function getProperties(): array return $this->properties; } + public function getTags(): SubtreeTags + { + return $this->tags; + } + public function getChildNodes(): Templates { return $this->childNodes; @@ -66,6 +74,7 @@ public function jsonSerialize(): array 'type' => $this->type, 'name' => $this->name, 'properties' => $this->properties, + 'tags' => $this->tags, 'childNodes' => $this->childNodes ]; } diff --git a/Classes/Domain/Template/Templates.php b/Classes/Domain/Template/Templates.php index a7f65c3..331fc4e 100644 --- a/Classes/Domain/Template/Templates.php +++ b/Classes/Domain/Template/Templates.php @@ -51,6 +51,7 @@ public function toRootTemplate(): RootTemplate foreach ($this->items as $first) { return new RootTemplate( $first->getProperties(), + $first->getTags(), $first->getChildNodes() ); } diff --git a/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php b/Classes/Domain/TemplateConfiguration/TemplateConfigurationProcessor.php index 5e5f189..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) { @@ -140,6 +165,7 @@ private function createTemplateFromTemplatePart(TemplatePart $templatePart): Tem $type !== null ? NodeTypeName::fromString($type) : null, $name !== null ? NodeName::fromString(Utility::renderValidNodeName($name)) : null, $processedProperties, + $processedTags, $childNodeTemplates ); } diff --git a/Classes/Domain/TemplateConfiguration/TemplatePart.php b/Classes/Domain/TemplateConfiguration/TemplatePart.php index d204ca6..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', '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, ['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 7955659..87d5926 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,22 @@ 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 / 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: + +```yaml +'Neos.NodeTypes:Page': + options: + template: + tags: + disabled: true +``` + ## EEL context variables There are several variables available in the EEL context for example. 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..5bd54e2 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/AllowedChildNodes.template.json @@ -1,10 +1,12 @@ { "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "content", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -12,6 +14,7 @@ "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 973a42e..102b671 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/ChildNodes.template.json @@ -1,10 +1,12 @@ { "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "column0", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -12,6 +14,7 @@ "properties": { "text": "

foo<\/p>" }, + "tags": [], "childNodes": [] } ] @@ -20,6 +23,7 @@ "type": null, "name": "column1", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -27,6 +31,7 @@ "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 14a1692..0084b37 100644 --- a/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json +++ b/Tests/Functional/Features/ChildNodes/Snapshots/DisallowedChildNodes.template.json @@ -1,10 +1,12 @@ { "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "content", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -12,6 +14,7 @@ "properties": { "text": "Text" }, + "tags": [], "childNodes": [] } ] @@ -20,6 +23,7 @@ "type": "Flowpack.NodeTemplates:Document.Page", "name": "illegal-node-1", "properties": [], + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/DisabledTag/DisabledTagTest.php b/Tests/Functional/Features/DisabledTag/DisabledTagTest.php new file mode 100644 index 0000000..a8abf91 --- /dev/null +++ b/Tests/Functional/Features/DisabledTag/DisabledTagTest.php @@ -0,0 +1,27 @@ +createNodeInto( + $this->homePageMainContentCollectionNode, + 'Flowpack.NodeTemplates:Content.DisabledTag', + [] + ); + + $this->assertNoExceptionsWereCaught(); + + $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/DisabledTag/Snapshots/DisabledTag.template.json b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.template.json new file mode 100644 index 0000000..bef5c10 --- /dev/null +++ b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.template.json @@ -0,0 +1,7 @@ +{ + "properties": [], + "tags": [ + "disabled" + ], + "childNodes": [] +} diff --git a/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.yaml b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.yaml new file mode 100644 index 0000000..f133bb4 --- /dev/null +++ b/Tests/Functional/Features/DisabledTag/Snapshots/DisabledTag.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..9f4cfc5 100644 --- a/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json +++ b/Tests/Functional/Features/Exceptions/Snapshots/OnlyExceptions.template.json @@ -1,4 +1,5 @@ { "properties": [], + "tags": [], "childNodes": [] } diff --git a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.messages.json index 3e23bdd..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(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 \"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 891cc60..f30099a 100644 --- a/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json +++ b/Tests/Functional/Features/Exceptions/Snapshots/SomeExceptions.template.json @@ -11,6 +11,7 @@ "working": "working", "nonDeclaredProperty": "hi" }, + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -18,12 +19,14 @@ "properties": { "text": "bar" }, + "tags": [], "childNodes": [] }, { "type": "Neos.Neos:Node", "name": null, "properties": [], + "tags": [], "childNodes": [] }, { @@ -32,6 +35,7 @@ "properties": { "text": "huhu" }, + "tags": [], "childNodes": [] }, { @@ -40,6 +44,7 @@ "properties": { "text": "123" }, + "tags": [], "childNodes": [] }, { @@ -48,24 +53,28 @@ "properties": { "text": "foo" }, + "tags": [], "childNodes": [] }, { "type": null, "name": null, "properties": [], + "tags": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:InvalidNodeType", "name": null, "properties": [], + "tags": [], "childNodes": [] }, { "type": "Flowpack.NodeTemplates:Content.SomeExceptions", "name": "type-cant-mutate", "properties": [], + "tags": [], "childNodes": [] } ] diff --git a/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json b/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json index f10add1..2f0ce2f 100644 --- a/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json +++ b/Tests/Functional/Features/NodeNames/Snapshots/NestedNodeNames.template.json @@ -1,10 +1,12 @@ { "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "container", "properties": [], + "tags": [], "childNodes": [ { "type": null, @@ -12,6 +14,7 @@ "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 e7320bc..3f8c34b 100644 --- a/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json +++ b/Tests/Functional/Features/NodeNames/Snapshots/NodeNames.template.json @@ -1,5 +1,6 @@ { "properties": [], + "tags": [], "childNodes": [ { "type": null, @@ -7,6 +8,7 @@ "properties": { "text": "legalNodeName" }, + "tags": [], "childNodes": [] }, { @@ -15,6 +17,7 @@ "properties": { "text": "capitalsInName" }, + "tags": [], "childNodes": [] }, { @@ -23,6 +26,7 @@ "properties": { "text": "\u00f6 - was soll das" }, + "tags": [], "childNodes": [] }, { @@ -31,6 +35,7 @@ "properties": { "text": "everythingMixedTogether" }, + "tags": [], "childNodes": [] }, { @@ -39,6 +44,7 @@ "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 37cee55..86def1e 100644 --- a/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json +++ b/Tests/Functional/Features/Pages/Snapshots/Pages1.template.json @@ -3,11 +3,13 @@ "title": "Page1", "uriPathSegment": "page1" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -15,6 +17,7 @@ "properties": { "text": "textOnPage1" }, + "tags": [], "childNodes": [] } ] @@ -26,11 +29,13 @@ "title": "Page2", "uriPathSegment": "page2" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -38,6 +43,7 @@ "properties": { "text": "textOnPage2" }, + "tags": [], "childNodes": [] } ] @@ -49,11 +55,13 @@ "title": "Page3", "uriPathSegment": "page3" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -61,6 +69,7 @@ "properties": { "text": "textOnPage3" }, + "tags": [], "childNodes": [] } ] @@ -76,11 +85,13 @@ "title": "Page4", "uriPathSegment": "page4" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -88,6 +99,7 @@ "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 a2517ab..67a4c2f 100644 --- a/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json +++ b/Tests/Functional/Features/Pages/Snapshots/Pages2.template.json @@ -1,10 +1,12 @@ { "properties": [], + "tags": [], "childNodes": [ { "type": null, "name": "main", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -12,6 +14,7 @@ "properties": { "text": "textOnPage1" }, + "tags": [], "childNodes": [] } ] @@ -22,11 +25,13 @@ "properties": { "title": "Page2" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -34,6 +39,7 @@ "properties": { "text": "textOnPage2" }, + "tags": [], "childNodes": [] } ] @@ -45,11 +51,13 @@ "title": "Page3", "uriPathSegment": "page3" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -57,6 +65,7 @@ "properties": { "text": "textOnPage3" }, + "tags": [], "childNodes": [] } ] @@ -71,11 +80,13 @@ "properties": { "title": "Page4" }, + "tags": [], "childNodes": [ { "type": null, "name": "main", "properties": [], + "tags": [], "childNodes": [ { "type": "Flowpack.NodeTemplates:Content.Text", @@ -83,6 +94,7 @@ "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 81c8297..bcd425d 100644 --- a/Tests/Functional/Features/Properties/Snapshots/Properties.template.json +++ b/Tests/Functional/Features/Properties/Snapshots/Properties.template.json @@ -7,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 7b462df..1053333 100644 --- a/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json +++ b/Tests/Functional/Features/ResolvableProperties/Snapshots/ResolvableProperties.template.json @@ -11,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 0921e0b..9164be1 100644 --- a/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json +++ b/Tests/Functional/Features/ResolvableProperties/Snapshots/UnresolvableProperties.template.json @@ -12,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 e4e0f03..7e828ad 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 "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 3602f63..caa35d1 100644 --- a/Tests/Functional/Features/Variables/Snapshots/Variables.template.json +++ b/Tests/Functional/Features/Variables/Snapshots/Variables.template.json @@ -2,5 +2,6 @@ "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),