From 0124d8920de7aa20d596051ddabd2a14b465295b Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 12 Jan 2024 18:01:28 +0100 Subject: [PATCH] TASK: 4621 adjust to uriPathSegment mixin --- .../DocumentTitleNodeCreationHandler.php | 12 +++++++----- Configuration/NodeTypes.yaml | 10 +--------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/Classes/NodeCreationHandler/DocumentTitleNodeCreationHandler.php b/Classes/NodeCreationHandler/DocumentTitleNodeCreationHandler.php index 1bba052b23..82af995e83 100644 --- a/Classes/NodeCreationHandler/DocumentTitleNodeCreationHandler.php +++ b/Classes/NodeCreationHandler/DocumentTitleNodeCreationHandler.php @@ -17,7 +17,6 @@ use Neos\ContentRepository\Core\Dimension\ContentDimensionId; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\Feature\NodeCreation\Command\CreateNodeAggregateWithNode; -use Neos\ContentRepository\Core\NodeType\NodeTypeManager; use Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException; use Neos\Flow\I18n\Locale; use Neos\Neos\Service\TransliterationService; @@ -44,10 +43,8 @@ class DocumentTitleNodeCreationHandler implements NodeCreationHandlerInterface */ public function handle(CreateNodeAggregateWithNode $command, array $data, ContentRepository $contentRepository): CreateNodeAggregateWithNode { - if ( - !$contentRepository->getNodeTypeManager()->getNodeType($command->nodeTypeName) - ->isOfType('Neos.Neos:Document') - ) { + $nodeType = $contentRepository->getNodeTypeManager()->getNodeType($command->nodeTypeName); + if (!$nodeType->isOfType('Neos.Neos:Document')) { return $command; } $propertyValues = $command->initialPropertyValues; @@ -55,6 +52,11 @@ public function handle(CreateNodeAggregateWithNode $command, array $data, Conten $propertyValues = $propertyValues->withValue('title', $data['title']); } + if (!$nodeType->isOfType('Neos.Neos:UriPathSegment')) { + return $command->withInitialPropertyValues($propertyValues); + } + // document with uri path segment property: + // if specified, the uriPathSegment equals the title $uriPathSegment = $data['title']; diff --git a/Configuration/NodeTypes.yaml b/Configuration/NodeTypes.yaml index a9296435b9..0fc74bc497 100644 --- a/Configuration/NodeTypes.yaml +++ b/Configuration/NodeTypes.yaml @@ -1,6 +1,5 @@ 'Neos.Neos:Document': ui: - group: 'general' creationDialog: elements: title: @@ -9,14 +8,7 @@ label: i18n editor: 'Neos.Neos/Inspector/Editors/TextFieldEditor' validation: - 'Neos.Neos/Validation/NotEmptyValidator': [] - properties: - uriPathSegment: - ui: - inspector: - editor: "Neos.Neos/Inspector/Editors/UriPathSegmentEditor" - editorOptions: - title: "ClientEval:node.properties.title" + 'Neos.Neos/Validation/NotEmptyValidator': {} options: nodeCreationHandlers: documentTitle: