diff --git a/Classes/MOC/SynchronizeUrl/Package.php b/Classes/MOC/SynchronizeUrl/Package.php index b6e5c77..3c5a597 100644 --- a/Classes/MOC/SynchronizeUrl/Package.php +++ b/Classes/MOC/SynchronizeUrl/Package.php @@ -17,7 +17,12 @@ public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap) { $newUriPathSegment = NULL; $dispatcher->connect('TYPO3\TYPO3CR\Domain\Model\Node', 'nodePropertyChanged', function(Node $node, $propertyName, $oldValue, $newValue) use($bootstrap, &$newUriPathSegment) { if ($propertyName === 'title' && $node->getNodeType()->isOfType('TYPO3.Neos:Document')) { - $newUriPathSegment = strtolower(\TYPO3\TYPO3CR\Utility::renderValidNodeName($node->getProperty('title'))); + if (method_exists('TYPO3\Neos\Utility\NodeUriPathSegmentGenerator', 'generateUriPathSegment')) { + $nodeUriPathSegmentGenerator = $bootstrap->getObjectManager()->get('TYPO3\Neos\Utility\NodeUriPathSegmentGenerator'); + $newUriPathSegment = strtolower($nodeUriPathSegmentGenerator->generateUriPathSegment($node)); + } else { + $newUriPathSegment = strtolower(\TYPO3\TYPO3CR\Utility::renderValidNodeName($node->getProperty('title') ?: $node->getName())); + } $node->setProperty('uriPathSegment', $newUriPathSegment); $bootstrap->getObjectManager()->get('TYPO3\Neos\Routing\Cache\RouteCacheFlusher')->registerNodeChange($node); } elseif ($propertyName === 'uriPathSegment' && $newUriPathSegment !== NULL && $newValue !== $newUriPathSegment) { @@ -27,4 +32,4 @@ public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap) { }); } -} \ No newline at end of file +}