[BUGFIX] Use correct title for links to create new records 95/45195/2
authorGeorg Ringer <georg.ringer@gmail.com>
Wed, 9 Dec 2015 13:34:47 +0000 (14:34 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 9 Dec 2015 22:23:56 +0000 (23:23 +0100)
If records can not be sorted, the title of the link should just state
'Create new record' instead of 'create new record after this record'.

Change-Id: I270ff1043b31366fbb8c90a259d52583a178f301
Resolves: #69934
Releases: master
Reviewed-on: https://review.typo3.org/45195
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index e3d6c7f..99a7b69 100644 (file)
@@ -1465,8 +1465,12 @@ class DatabaseRecordList extends AbstractDatabaseRecordList
                     if ($this->showNewRecLink($table)) {
                         $params = '&edit[' . $table . '][' . -($row['_MOVE_PLH'] ? $row['_MOVE_PLH_uid'] : $row['uid']) . ']=new';
                         $icon = ($table == 'pages' ? $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL) : $this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL));
+                        $titleLabel = 'new';
+                        if ($GLOBALS['TCA'][$table]['ctrl']['sortby']) {
+                            $titleLabel .= ($table === 'pages' ? 'Page' : 'Record');
+                        }
                         $newAction = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1))
-                            . '" title="' . $this->getLanguageService()->getLL('new' . ($table == 'pages ' ? 'Page' : 'Record'), true) . '">'
+                            . '" title="' . htmlspecialchars($this->getLanguageService()->getLL($titleLabel)) . '">'
                             . $icon->render() . '</a>';
                         $this->addActionToCellGroup($cells, $newAction, 'new');
                     }