[BUGFIX] Ensure to use parent's page slug for generating a new pages' slug
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / DataHandling / SlugHelper.php
index c081e8b..e2a8369 100644 (file)
@@ -151,7 +151,12 @@ class SlugHelper
                 }
             }
             if (is_array($parentPageRecord)) {
-                $rootLineItemSlug = $this->generate($parentPageRecord, (int)$parentPageRecord['pid']);
+                // If the parent page has a slug, use that instead of "re-generating" the slug from the parents' page title
+                if (!empty($parentPageRecord['slug'])) {
+                    $rootLineItemSlug = $parentPageRecord['slug'];
+                } else {
+                    $rootLineItemSlug = $this->generate($parentPageRecord, (int)$parentPageRecord['pid']);
+                }
                 $rootLineItemSlug = trim($rootLineItemSlug, '/');
                 if (!empty($rootLineItemSlug)) {
                     $prefix = $rootLineItemSlug;