Commit 5519649d authored by Guido Schmechel's avatar Guido Schmechel Committed by Frank Nägler
Browse files

[BUGFIX] Use pageTree.backgroundColor recursively

When a page is listed in the pageTree, the option
pageTree.backgroundColor is recursively checked and all
subpages get the backgroundColor.

Now with subpages as a mount, the backgroundColor of the
parent page is adopted.

Resolves: #81987
Releases: master, 8.7
Change-Id: I29d444da96d9d2038a4940896fd848bf42e43f47
Reviewed-on: https://review.typo3.org/56489


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Naegler <frank.naegler@typo3.org>
parent 0bcc546e
......@@ -29,6 +29,7 @@ use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation;
use TYPO3\CMS\Core\Type\Bitmask\Permission;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Page\PageRepository;
use TYPO3\CMS\Workspaces\Service\WorkspaceService;
/**
......@@ -324,6 +325,8 @@ class TreeController
{
$backendUser = $this->getBackendUser();
$repository = GeneralUtility::makeInstance(PageTreeRepository::class, (int)$backendUser->workspace);
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$entryPoints = (int)($backendUser->uc['pageTree_temporaryMountPoint'] ?? 0);
if ($entryPoints > 0) {
$entryPoints = [$entryPoints];
......@@ -340,11 +343,23 @@ class TreeController
if (empty($entryPoints)) {
return [];
}
foreach ($entryPoints as $k => &$entryPoint) {
if (in_array($entryPoint, $this->hiddenRecords, true)) {
unset($entryPoints[$k]);
continue;
}
if (!empty($this->backgroundColors) && is_array($this->backgroundColors)) {
$entryPointRootLine = $pageRepository->getRootLine($entryPoint);
foreach ($entryPointRootLine as $rootLineEntry) {
$parentUid = $rootLineEntry['uid'];
if ($this->backgroundColors[$parentUid] !== null && $this->backgroundColors[$entryPoint] === null) {
$this->backgroundColors[$entryPoint] = $this->backgroundColors[$parentUid];
}
}
}
$entryPoint = $repository->getTree($entryPoint, function ($page) use ($backendUser) {
// check each page if the user has permission to access it
return $backendUser->doesUserHaveAccess($page, Permission::PAGE_SHOW);
......
Supports Markdown
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