From 80be67711dadd6ec5914ebf17c954aa0e9c3a12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jasmina=20Lie=C3=9Fmann?= <minapokhalo+typo3@gmail.com> Date: Mon, 1 Jan 2024 18:40:02 +0100 Subject: [PATCH] [BUGFIX] Show creator name in element information modal This patch ensures that the username and - if available - the real name of the author are displayed again in the element information modal. The corresponding field label is now also displayed. Resolves: #102737 Related: #102469 Releases: main, 12.4 Change-Id: I960e274b98aec7289c84a6eaee54b7d3ccdc3cc9 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82293 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82298 Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de> Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Oliver Bartsch <bo@cedev.de> --- .../ElementInformationController.php | 10 +++------- .../ContentElement/ElementInformation.html | 14 ++++++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php b/typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php index 5676c1470faf..f8d7e1f908a9 100644 --- a/typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php +++ b/typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php @@ -20,7 +20,6 @@ namespace TYPO3\CMS\Backend\Controller\ContentElement; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Backend\Attribute\Controller; -use TYPO3\CMS\Backend\Backend\Avatar\Avatar; use TYPO3\CMS\Backend\Form\FormDataCompiler; use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord; use TYPO3\CMS\Backend\History\RecordHistory; @@ -397,16 +396,13 @@ class ElementInformationController } // Show the user who created the record $recordHistory = GeneralUtility::makeInstance(RecordHistory::class); - $ownerInformation = $recordHistory->getCreationInformationForRecord($this->type, $this->row); - $ownerUid = (int)(is_array($ownerInformation) && $ownerInformation['actiontype'] === 'BE' ? $ownerInformation['userid'] : 0); + $ownerInformation = $recordHistory->getCreationInformationForRecord($this->table, $this->row); + $ownerUid = (int)(is_array($ownerInformation) && $ownerInformation['usertype'] === 'BE' ? $ownerInformation['userid'] : 0); if ($ownerUid) { $creatorRecord = BackendUtility::getRecord('be_users', $ownerUid); if ($creatorRecord) { - $avatar = GeneralUtility::makeInstance(Avatar::class); - $creatorRecord['icon'] = $avatar->render($creatorRecord); - $rowValue = $creatorRecord; $keyLabelPair['creatorRecord'] = [ - 'value' => $rowValue, + 'value' => $creatorRecord, 'fieldLabel' => rtrim(htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.creationUserId')), ':'), ]; } diff --git a/typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html b/typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html index 2132d812993e..ca7e8246cea0 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ContentElement/ElementInformation.html @@ -1,5 +1,6 @@ <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" + xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers" xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true" > @@ -55,15 +56,20 @@ </f:for> </div> <f:if condition="{extraFields.creatorRecord}"> - <div class="row mt-2"> + <div class="row mt-3"> + <div class="col-md-12"> + <strong>{extraFields.creatorRecord.fieldLabel}</strong> + </div> <div class="col-md-12"> <div class="media"> <div class="media-left"> - {extraFields.creatorRecord.value.icon -> f:format.raw()} + <be:avatar backendUser="{extraFields.creatorRecord.value.uid}" showIcon="true" /> </div> <div class="media-body"> - <strong>{extraFields.creatorRecord.value.username}</strong><br> - {extraFields.creatorRecord.value.realName} + <f:if condition="{extraFields.creatorRecord.value.realName}"> + <f:then>{extraFields.creatorRecord.value.realName}<br>({extraFields.creatorRecord.value.username})</f:then> + <f:else>{extraFields.creatorRecord.value.username}</f:else> + </f:if> </div> </div> </div> -- GitLab