From 5cfbd008a78f54160fba85ac2caf77842a85d0d8 Mon Sep 17 00:00:00 2001
From: Elmar Hinz <t3elmar@gmail.com>
Date: Sat, 20 May 2017 15:03:14 +0200
Subject: [PATCH] [CLEANUP] Review comment and sig of
 addMountPointParameterToPage()

Releases: master, 8.7
Resolves: #81280
Change-Id: I8689827c9e33202e7659a39bb55e7a9bfd792aa2
Reviewed-on: https://review.typo3.org/52877
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../frontend/Classes/Page/PageRepository.php  | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/frontend/Classes/Page/PageRepository.php b/typo3/sysext/frontend/Classes/Page/PageRepository.php
index 8c694197f8f3..1b019b18ac64 100644
--- a/typo3/sysext/frontend/Classes/Page/PageRepository.php
+++ b/typo3/sysext/frontend/Classes/Page/PageRepository.php
@@ -731,12 +731,21 @@ class PageRepository
     }
 
     /**
-     * Add the mount point parameter to the page if needed
+     * Replaces the given page record with mounted page if required
      *
-     * @param array $page The page to check
-     * @return array
+     * If the given page record is a mount point in overlay mode, the page
+     * record is replaced by the record of the overlaying page. The overlay
+     * record is enriched by setting the mount point mapping into the field
+     * _MP_PARAM as string for example '23-14'.
+     *
+     * In all other cases the given page record is returned as is.
+     *
+     * @todo Find a better name. The current doesn't hit the point.
+     *
+     * @param array $page The page record to handle.
+     * @return array The given page record or it's replacement.
      */
-    protected function addMountPointParameterToPage(array $page)
+    protected function addMountPointParameterToPage(array $page): array
     {
         if (empty($page)) {
             return [];
@@ -745,7 +754,7 @@ class PageRepository
         // $page MUST have "uid", "pid", "doktype", "mount_pid", "mount_pid_ol" fields in it
         $mountPointInfo = $this->getMountPointInfo($page['uid'], $page);
 
-        // There is a valid mount point.
+        // There is a valid mount point in overlay mode.
         if (is_array($mountPointInfo) && $mountPointInfo['overlay']) {
 
             // Using "getPage" is OK since we need the check for enableFields AND for type 2
-- 
GitLab