From 5efb0832081b688c9fa7c49c00dc7998ac157c2e Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Mon, 6 Mar 2023 09:32:24 +0100
Subject: [PATCH] [FEATURE] Show path to record location in group elements

To ease the usage of `group` fields in the FormEngine like e.g. in the
"Insert records" content element, the record overview now shows the
path to the location where each assigned record is stored,
respectively.

Resolves: #100093
Releases: main
Change-Id: I1623b506727b46ccc86361e2c061c7e2c705a50f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78033
Reviewed-by: Torben Hansen <derhansen@gmail.com>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Torben Hansen <derhansen@gmail.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../Form/FieldWizard/RecordsOverview.php      |  4 +++
 ...howPathToRecordLocationInGroupElements.rst | 25 +++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/12.3/Feature-100093-ShowPathToRecordLocationInGroupElements.rst

diff --git a/typo3/sysext/backend/Classes/Form/FieldWizard/RecordsOverview.php b/typo3/sysext/backend/Classes/Form/FieldWizard/RecordsOverview.php
index 617957cf4669..e3cbc989550c 100644
--- a/typo3/sysext/backend/Classes/Form/FieldWizard/RecordsOverview.php
+++ b/typo3/sysext/backend/Classes/Form/FieldWizard/RecordsOverview.php
@@ -23,6 +23,7 @@ use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Localization\LanguageService;
+use TYPO3\CMS\Core\Type\Bitmask\Permission;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -62,6 +63,8 @@ class RecordsOverview extends AbstractNode
                 $selectedItem['table'],
                 $selectedItem['uid']
             );
+            $pathToContainingPage = BackendUtility::getRecordPath($selectedItem['row']['pid'], $this->getBackendUserAuthentication()->getPagePermsClause(Permission::PAGE_SHOW), 0);
+
             $recordsOverviewHtml[] = '<tr>';
             $recordsOverviewHtml[] =    '<td class="col-icon">';
             $recordsOverviewHtml[] =        $linkedIcon;
@@ -70,6 +73,7 @@ class RecordsOverview extends AbstractNode
             $recordsOverviewHtml[] =        $linkedTitle;
             $recordsOverviewHtml[] =        '<span class="text-muted">';
             $recordsOverviewHtml[] =            ' [' . $selectedItem['uid'] . ']';
+            $recordsOverviewHtml[] =            ' ' . htmlspecialchars($pathToContainingPage);
             $recordsOverviewHtml[] =        '</span>';
             $recordsOverviewHtml[] =    '</td>';
             $recordsOverviewHtml[] = '</tr>';
diff --git a/typo3/sysext/core/Documentation/Changelog/12.3/Feature-100093-ShowPathToRecordLocationInGroupElements.rst b/typo3/sysext/core/Documentation/Changelog/12.3/Feature-100093-ShowPathToRecordLocationInGroupElements.rst
new file mode 100644
index 000000000000..dd61dc50cd46
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/12.3/Feature-100093-ShowPathToRecordLocationInGroupElements.rst
@@ -0,0 +1,25 @@
+.. include:: /Includes.rst.txt
+
+.. _feature-100093-1678091347:
+
+=================================================================
+Feature: #100093 - Show path to record location in group elements
+=================================================================
+
+See :issue:`100093`
+
+Description
+===========
+
+To ease the usage of `group` fields in the FormEngine like e.g. in the
+"Insert records" content element, the record overview now shows the path to the
+location where each assigned record is stored, respectively.
+
+
+Impact
+======
+
+Elements of type `group` now show the path to the page where any assigned record
+is stored in.
+
+.. index:: Backend, ext:backend
-- 
GitLab