Skip to content

Commit

Permalink
TASK: 4621 adjust to uriPathSegment mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Jan 12, 2024
1 parent 5758aa4 commit 0124d89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 7 additions & 5 deletions Classes/NodeCreationHandler/DocumentTitleNodeCreationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -44,17 +43,20 @@ 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;
if (isset($data['title'])) {
$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'];

Expand Down
10 changes: 1 addition & 9 deletions Configuration/NodeTypes.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'Neos.Neos:Document':
ui:
group: 'general'
creationDialog:
elements:
title:
Expand All @@ -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:
Expand Down

0 comments on commit 0124d89

Please sign in to comment.