[FEATURE] Link Shortcut pages directly to target
authorThorben Kapp <thorben@work.de>
Tue, 19 Jul 2011 11:23:31 +0000 (13:23 +0200)
committerSteffen Gebert <steffen.gebert@typo3.org>
Sat, 30 Jul 2011 22:16:57 +0000 (00:16 +0200)
Menu items of type shortcut link to the target directly now,
even without realurl.

Change-Id: I444d9eddf4c98c9a8712627bbc5bd24a4c6aebc8
Related: #17037
Releases: 4.6
Reviewed-on: http://review.typo3.org/3413
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Steffen Gebert
Tested-by: Steffen Gebert
typo3/sysext/cms/tslib/class.tslib_menu.php

index 31efddb..bb5ef4b 100644 (file)
@@ -1171,6 +1171,30 @@ class tslib_menu {
                        $LD['target'] = '';
                }
 
+                       // Override url if current page is a shortcut
+               if ($this->menuArr[$key]['doktype'] == t3lib_pageSelect::DOKTYPE_SHORTCUT
+                       && $this->menuArr[$key]['shortcut_mode'] != t3lib_pageSelect::SHORTCUT_MODE_RANDOM_SUBPAGE) {
+
+                       $shortcut = NULL;
+                       try {
+                               $shortcut = $GLOBALS['TSFE']->getPageShortcut(
+                                       $this->menuArr[$key]['shortcut'],
+                                       $this->menuArr[$key]['shortcut_mode'],
+                                       $this->menuArr[$key]['uid']
+                               );
+                       } catch (Exception $ex) {
+                               // shortcut configuration is wrong and Exception is thrown
+                               // this will be catched with the next is_array() check
+                       }
+
+                       if (!is_array($shortcut)) {
+                               return FALSE;
+                       }
+
+                               // Only setting url, not target
+                       $LD['totalURL'] = $this->parent_cObj->typoLink_URL(array('parameter' => $shortcut['uid']));
+               }
+
                        // Manipulation in case of access restricted pages:
                $this->changeLinksForAccessRestrictedPages($LD,$this->menuArr[$key],$mainTarget,$typeOverride);