From 0d85dbaf9285baee864763ffa89ba8139af27458 Mon Sep 17 00:00:00 2001 From: Alexander Opitz Date: Mon, 20 Aug 2018 17:22:53 +0200 Subject: [PATCH] [BUGFIX] Show page flag/title in language, show element uid This fixes the output for flag/title of translated pages and the uid of every element as tooltip on the menu icon as this is done by core page layout module. Resolves: #199 --- Classes/Controller/BackendLayoutController.php | 14 ++++++++++++-- Classes/Service/ApiService.php | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Classes/Controller/BackendLayoutController.php b/Classes/Controller/BackendLayoutController.php index 2c0655858..5ce155566 100644 --- a/Classes/Controller/BackendLayoutController.php +++ b/Classes/Controller/BackendLayoutController.php @@ -630,6 +630,7 @@ public function main() } else { $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); } + $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip'); // Set up JS for dynamic tab menu and side bar $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tabs'); @@ -1321,7 +1322,9 @@ public function render_framework_singleSheet($contentTreeArr, $languageKey, $she $elementClass .= ' tpm-container-element-depth-' . $contentTreeArr['depth']; $elementClass .= ' tpm-container-element-depth-' . ($contentTreeArr['depth'] % 2 ? 'odd' : 'even'); - $recordIcon = $contentTreeArr['el']['iconTag']; + $recordIcon = '' + . $contentTreeArr['el']['iconTag'] + . ''; $menuCommands = array(); if (TemplaVoilaUtility::getBackendUser()->isPSet($calcPerms, 'pages', 'new')) { @@ -1347,6 +1350,13 @@ public function render_framework_singleSheet($contentTreeArr, $languageKey, $she case 'pages': $elementTitlebarClass = 't3-page-column-header'; $elementClass .= ' pagecontainer'; + $languageUid = $this->currentLanguageUid; + if ($this->currentLanguageUid !== 0) { + $row = BackendUtility::getRecordLocalization($contentTreeArr['el']['table'], $contentTreeArr['el']['uid'], $this->currentLanguageUid); + if ($row) { + $contentTreeArr['el']['fullTitle'] = BackendUtility::getRecordTitle('pages', $row[0]); + } + } break; case 'tt_content': @@ -1412,7 +1422,7 @@ public function render_framework_singleSheet($contentTreeArr, $languageKey, $she } // Prepare the language icon: - $languageLabel = htmlspecialchars($this->allAvailableLanguages[$contentTreeArr['el']['sys_language_uid']]['title']); + $languageLabel = htmlspecialchars($this->allAvailableLanguages[$languageUid]['title']); if ($this->allAvailableLanguages[$languageUid]['flagIcon']) { $languageIcon = \Ppi\TemplaVoilaPlus\Utility\IconUtility::getFlagIconForLanguage( $this->allAvailableLanguages[$languageUid]['flagIcon'], diff --git a/Classes/Service/ApiService.php b/Classes/Service/ApiService.php index a5bb7d5f2..5a7c3ac00 100644 --- a/Classes/Service/ApiService.php +++ b/Classes/Service/ApiService.php @@ -1508,7 +1508,7 @@ public function getContentTree_element($table, $row, &$tt_content_elementRegiste 'fullTitle' => BackendUtility::getRecordTitle($table, $row), 'icon' => '', // kept because it's not clear if this is used elsewhere 'iconTag' => $this->iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render(), - 'sys_language_uid' => $row['sys_language_uid'], + 'sys_language_uid' => (int) $row['sys_language_uid'], 'l18n_parent' => $row['l18n_parent'], 'CType' => $row['CType'], 'layout' => $row['layout'],