[TASK] Give better info about no records 02/61902/6
authorPascal Querner <pq@paskl.de>
Mon, 7 Oct 2019 12:38:42 +0000 (14:38 +0200)
committerSusanne Moog <look@susi.dev>
Thu, 10 Oct 2019 09:37:48 +0000 (11:37 +0200)
This patch adds a better info text when no records of a specific type
don't exist, instead of giving the generic answer "no records exists on
this page" (which may not be true).

Resolves: #88985
Releases: master, 9.5
Change-Id: I780e845a0c224815e710cf8246e407198a1e6cb0
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61902
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com>
Tested-by: Jörg Bösche <typo3@joergboesche.de>
Tested-by: Susanne Moog <look@susi.dev>
Reviewed-by: Sascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Susanne Moog <look@susi.dev>
typo3/sysext/core/Resources/Private/Language/locallang_mod_web_list.xlf
typo3/sysext/recordlist/Classes/Controller/RecordListController.php

index 5263d14..37f253e 100644 (file)
                        <trans-unit id="noRecordsOnThisPage" resname="noRecordsOnThisPage">
                                <source>There are no records on this page.</source>
                        </trans-unit>
+                       <trans-unit id="noRecordsOfTypeOnThisPage" resname="noRecordsOfTypeOnThisPage">
+                <source>There are no records of type "%s" on this page.</source>
+            </trans-unit>
                        <trans-unit id="button.cancel" resname="button.cancel">
                                <source>Cancel</source>
                        </trans-unit>
index aa86c20..47c1bb2 100644 (file)
@@ -461,12 +461,22 @@ class RecordListController
         if (!empty($dblist->HTMLcode)) {
             $output .= $dblist->HTMLcode;
         } else {
+            if (isset($this->table, $GLOBALS['TCA'][$this->table]['ctrl']['title'])) {
+                if (strpos($GLOBALS['TCA'][$this->table]['ctrl']['title'], 'LLL:') === 0) {
+                    $ll = sprintf($lang->getLL('noRecordsOfTypeOnThisPage'), $lang->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']));
+                } else {
+                    $ll = sprintf($lang->getLL('noRecordsOfTypeOnThisPage'), $GLOBALS['TCA'][$this->table]['ctrl']['title']);
+                }
+            } else {
+                $ll = $lang->getLL('noRecordsOnThisPage');
+            }
             $flashMessage = GeneralUtility::makeInstance(
                 FlashMessage::class,
-                $lang->getLL('noRecordsOnThisPage'),
+                $ll,
                 '',
                 FlashMessage::INFO
             );
+            unset($ll);
             /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
             $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
             /** @var \TYPO3\CMS\Core\Messaging\FlashMessageQueue $defaultFlashMessageQueue */