From 4fe45e4d862d233b4338a746d1aea2c885a98119 Mon Sep 17 00:00:00 2001
From: Frederik Holz <frederik.holz@gmail.com>
Date: Wed, 2 May 2018 17:41:09 +0200
Subject: [PATCH] [BUGFIX] Respect showAccessRestrictedPages in MenuProcessor

Menues provided by MenuProcessor will display restricted
pages, if the configuration value is set to true. This is the
same behavior as known from pure TypoScript provided menues.

Resolves: #82755
Releases: master, 8.7
Change-Id: Idf600f3ce151e2accba828c69dc601e26771686c
Reviewed-on: https://review.typo3.org/56834
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
---
 .../frontend/Classes/DataProcessing/MenuProcessor.php    | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/typo3/sysext/frontend/Classes/DataProcessing/MenuProcessor.php b/typo3/sysext/frontend/Classes/DataProcessing/MenuProcessor.php
index 693b64ad359b..2e7534eb89fc 100644
--- a/typo3/sysext/frontend/Classes/DataProcessing/MenuProcessor.php
+++ b/typo3/sysext/frontend/Classes/DataProcessing/MenuProcessor.php
@@ -94,6 +94,8 @@ class MenuProcessor implements DataProcessorInterface
         'begin.',
         'alternativeSortingField',
         'alternativeSortingField.',
+        'showAccessRestrictedPages',
+        'showAccessRestrictedPages.',
         'excludeUidList',
         'excludeUidList.',
         'excludeDoktypes',
@@ -356,6 +358,13 @@ class MenuProcessor implements DataProcessorInterface
             if ($i > 1) {
                 $this->menuConfig[$i . '.']['stdWrap.']['wrap'] = ',"children": [|]';
             }
+            if (array_key_exists('showAccessRestrictedPages', $this->menuConfig)) {
+                $this->menuConfig[$i . '.']['showAccessRestrictedPages'] = $this->menuConfig['showAccessRestrictedPages'];
+                if (array_key_exists('showAccessRestrictedPages.', $this->menuConfig)
+                    && is_array($this->menuConfig['showAccessRestrictedPages.'])) {
+                    $this->menuConfig[$i . '.']['showAccessRestrictedPages.'] = $this->menuConfig['showAccessRestrictedPages.'];
+                }
+            }
             $this->menuConfig[$i . '.']['expAll'] = $this->menuExpandAll;
             $this->menuConfig[$i . '.']['alternativeSortingField'] = $this->menuAlternativeSortingField;
             $this->menuConfig[$i . '.']['NO'] = '1';
-- 
GitLab