Skip to content

Commit

Permalink
[BUGFIX] Do not render hidden pages in HMENU list
Browse files Browse the repository at this point in the history
Resolves: #96358
Releases: main, 11.5
Change-Id: I36b7ddc31eb3e240c86f3a550d068d7577099f6e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72686
Tested-by: core-ci <typo3@b13.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
  • Loading branch information
bmack authored and o-ba committed Dec 16, 2021
1 parent 9fbda17 commit 0c04d91
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 8 deletions.
Expand Up @@ -698,12 +698,10 @@ protected function prepareMenuItemsForListMenu($specialValue)
}
$pageIds = GeneralUtility::intExplode(',', (string)$specialValue);
$disableGroupAccessCheck = !empty($this->mconf['showAccessRestrictedPages']);
$pageRecords = $this->sys_page->getMenuForPages($pageIds);
$pageLinkBuilder = GeneralUtility::makeInstance(PageLinkBuilder::class, $this->parent_cObj);
foreach ($pageIds as $pageId) {
$row = $this->sys_page->getPage($pageId, $disableGroupAccessCheck);
if (!is_array($row)) {
continue;
}
foreach ($pageRecords as $row) {
$pageId = (int)$row['uid'];
$MP = $pageLinkBuilder->getMountPointParameterFromRootPointMaps($pageId);
// Keep mount point?
$mount_info = $this->sys_page->getMountPointInfo($pageId, $row);
Expand Down
Expand Up @@ -809,9 +809,6 @@ public function hierarchicalMenuIsGenerated(string $hostPrefix, int $sourcePageI
self::assertSame($expectation, $json);
}

/**
* @return array
*/
public function directoryMenuIsGeneratedDataProvider(): array
{
return [
Expand Down Expand Up @@ -967,6 +964,83 @@ public function directoryMenuIsGenerated(string $hostPrefix, int $sourcePageId,
self::assertSame($expectation, $json);
}

public function listMenuIsGeneratedDataProvider(): array
{
return [
'Live' => [
'https://acme.us/',
1100,
[1100, 1600, 1700, 1800, 1520],
0,
0,
[
[
'title' => 'EN: Welcome',
'link' => '/welcome',
],
[
'title' => 'About us',
'link' => '/about',
],
[
'title' => 'Announcements & News',
'link' => '/news',
],
],
],
'Workspaces' => [
'https://acme.us/',
1100,
[1100, 1600, 1700, 1800, 1520],
1,
1,
[
[
'title' => 'EN: Welcome to ACME Inc',
'link' => '/welcome-modified',
],
[
'title' => 'About us',
'link' => '/about',
],
[
'title' => 'Announcements & News',
'link' => '/news',
],
],
],
];
}

/**
* @test
* @dataProvider listMenuIsGeneratedDataProvider
*/
public function listMenuIsGenerated(string $hostPrefix, int $sourcePageId, array $menuPageIds, int $backendUserId, int $workspaceId, array $expectation): void
{
$response = $this->executeFrontendSubRequest(
(new InternalRequest($hostPrefix))
->withPageId($sourcePageId)
->withInstructions([
$this->createHierarchicalMenuProcessorInstruction([
'special' => 'list',
'special.' => [
'value' => implode(',', $menuPageIds),
],
'titleField' => 'title',
]),
]),
(new InternalRequestContext())
->withWorkspaceId($backendUserId !== 0 ? $workspaceId : 0)
->withBackendUserId($backendUserId)
);

$json = json_decode((string)$response->getBody(), true);
$json = $this->filterMenu($json);

self::assertSame($expectation, $json);
}

/**
* @return array
*/
Expand Down

0 comments on commit 0c04d91

Please sign in to comment.