[BUGFIX] Set correct shortcut name when creating bookmark in root level 06/44006/2
authorFrans Saris <franssaris@gmail.com>
Mon, 12 Oct 2015 09:46:21 +0000 (11:46 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 18 Oct 2015 16:04:59 +0000 (18:04 +0200)
Resolves: #70612
Releases: master
Change-Id: If4315a18885cdafa356f2a2b3ddadee0111ce291
Reviewed-on: http://review.typo3.org/44006
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php

index 7bc8578..cb0edcc 100644 (file)
@@ -577,17 +577,22 @@ class ShortcutToolbarItem implements ToolbarItemInterface
             } else {
                 // Lookup the title of this page and use it as default description
                 $pageId = (int)($shortcut['pid'] ?: ($shortcut['recordid'] ?: $this->getLinkedPageId($url)));
+                $page = FALSE;
                 if ($pageId) {
                     $page = BackendUtility::getRecord('pages', $pageId);
-
-                    if (!empty($page)) {
-                        // Set the name to the title of the page
-                        if ($shortcut['type'] === 'other') {
-                            $shortcutName = $page['title'];
-                        } else {
-                            $shortcutName = $shortcutNamePrepend . ' ' . $languageService->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']) . ' (' . $page['title'] . ')';
-                        }
+                }
+                if (!empty($page)) {
+                    // Set the name to the title of the page
+                    if ($shortcut['type'] === 'other') {
+                        $shortcutName = $page['title'];
+                    } else {
+                        $shortcutName = $shortcutNamePrepend . ' ' .
+                            $languageService->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']) .
+                            ' (' . $page['title'] . ')';
                     }
+                } elseif ($shortcut['table'] !== '' && $shortcut['type'] !== 'other') {
+                    $shortcutName = $shortcutNamePrepend . ' ' .
+                        $languageService->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']);
                 }
             }