Skip to content
Snippets Groups Projects
Commit eeeacf64 authored by Christian Eßl's avatar Christian Eßl Committed by Georg Ringer
Browse files

[TASK] Lift doktype restrictions in SlugHelper::resolveParentPageRecord

The changes made in #18079 lifted the restrictions for using doktypes
with a number higher than 200 in several parts of the frontend.
These restrictions were still present in the SlugHelper upon resolving
a parent page record (which automatically fetches the slugs of parent
pages for a child page upon creating its slug).
This hard restriction made it impossible to automatically resolve the
slug of a parent page with a doktype higher than 200.

The check is now adjusted to solely exclude the following doktypes:
* DOKTYPE_SPACER (199)
* DOKTYPE_SYSFOLDER (254)
* DOKTYPE_RECYCLER (255)

Resolves: #90947
Related: #18079
Releases: master
Change-Id: Ia71ad2251969a73875124c80ea7521212e459150
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64073


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarGuido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent a8155cbc
No related merge requests found
......@@ -25,6 +25,7 @@ use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Database\Query\Restriction\WorkspaceRestriction;
use TYPO3\CMS\Core\DataHandling\Model\RecordState;
use TYPO3\CMS\Core\DataHandling\Model\RecordStateFactory;
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -548,7 +549,7 @@ class SlugHelper
}
/**
* Fetch a parent page, but exclude spacers, recyclers and sys-folders and all doktypes > 200
* Fetch a parent page, but exclude spacers, recyclers and sys-folders
* @param int $pid
* @param int $languageId
* @return array|null
......@@ -557,10 +558,15 @@ class SlugHelper
{
$parentPageRecord = null;
$rootLine = BackendUtility::BEgetRootLine($pid, '', true, ['nav_title']);
$excludeDokTypes = [
PageRepository::DOKTYPE_SPACER,
PageRepository::DOKTYPE_RECYCLER,
PageRepository::DOKTYPE_SYSFOLDER
];
do {
$parentPageRecord = array_shift($rootLine);
// do not use spacers (199), recyclers and folders and everything else
} while (!empty($rootLine) && (int)$parentPageRecord['doktype'] >= 199);
// exclude spacers, recyclers and folders
} while (!empty($rootLine) && in_array((int)$parentPageRecord['doktype'], $excludeDokTypes, true));
if ($languageId > 0) {
$languageIds = [$languageId];
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment