Skip to content

Commit

Permalink
TASK: Compatibility with Neos 2.1.6+
Browse files Browse the repository at this point in the history
Uses the newly introduced ``TYPO3\Neos\Utility\NodeUriPathSegmentGenerator->generateUriPathSegment``
method if available.
  • Loading branch information
aertmann committed Mar 28, 2016
1 parent 077fc3e commit a12c2f9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Classes/MOC/SynchronizeUrl/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -27,4 +32,4 @@ public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap) {
});
}

}
}

0 comments on commit a12c2f9

Please sign in to comment.