[BUGFIX] Properly create slug if adding new pages via FormEngine 17/58117/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 1 Sep 2018 19:06:30 +0000 (21:06 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 1 Sep 2018 19:21:42 +0000 (21:21 +0200)
Adding a page relative to another page (vanillaUid is negative then),
currently creates a slug as if the page in inside the related page.
This is because the vanillaUid is given to the JS and later fed to
the ajax slug creator.
Using 'effectivePid' instead which is the parent page uid if a
new page is added, or the uid of the page recod itself if the
page is edited, solves the issue.

Resolves: #86074
Releases: master
Change-Id: Ia3f89f615699d4e7be6bc1762bc95e17cc1939dc
Reviewed-on: https://review.typo3.org/58117
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Kevin Appelt <kevin.appelt@icloud.com>
Tested-by: Kevin Appelt <kevin.appelt@icloud.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/Element/InputSlugElement.php

index fc49de3..879df50 100644 (file)
@@ -155,7 +155,7 @@ class InputSlugElement extends AbstractFormElement
                 '',
                 [
                     $table,
-                    $this->data['vanillaUid'] < 0 ? abs($this->data['vanillaUid']) : $this->data['effectivePid'],
+                    $this->data['effectivePid'],
                     $row['uid'],
                     $languageId,
                     $this->data['fieldName'],
@@ -165,7 +165,7 @@ class InputSlugElement extends AbstractFormElement
             FormSlugAjaxController::class
         );
         $optionsForModule = [
-            'pageId' => $this->data['vanillaUid'] < 0 ? abs($this->data['vanillaUid']) : $this->data['effectivePid'],
+            'pageId' => $this->data['effectivePid'],
             'recordId' => $row['uid'],
             'tableName' => $table,
             'fieldName' => $this->data['fieldName'],