[BUGFIX] Add route information to Backend shortcuts 79/43879/4
authorBenjamin Mack <benni@typo3.org>
Wed, 7 Oct 2015 06:11:39 +0000 (08:11 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 9 Oct 2015 20:26:29 +0000 (22:26 +0200)
Resolves: #70248
Releases: master
Change-Id: I2ead1ca8b220b6a2f7168cfa85a5427503688509
Reviewed-on: http://review.typo3.org/43879
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Daniel Lorenz <forge@extco.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Backend/ToolbarItems/ShortcutToolbarItem.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php

index 825ce4a..45a92e8 100644 (file)
@@ -340,6 +340,22 @@ class ShortcutToolbarItem implements ToolbarItemInterface
         if (strpos($parsedUrl['path'], 'index.php') !== false && isset($parameters['M'])) {
             $module = $parameters['M'];
             $url = BackendUtility::getModuleUrl($module, $parameters);
+        } elseif (strpos($parsedUrl['path'], 'index.php') !== false && isset($parameters['route'])) {
+            $routePath = $parameters['route'];
+            /** @var \TYPO3\CMS\Backend\Routing\Router $router */
+            $router = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\Router::class);
+            try {
+                $route = $router->match($routePath);
+                if ($route) {
+                    $routeIdentifier = $route->getOption('_identifier');
+                    /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
+                    $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+                    unset($parameters['route']);
+                    $url = (string)$uriBuilder->buildUriFromRoute($routeIdentifier, $parameters);
+                }
+            } catch (\TYPO3\CMS\Backend\Routing\Exception\ResourceNotFoundException $e) {
+                $url = '';
+            }
         }
         return $url;
     }
index 1f660ba..03cf3cc 100644 (file)
@@ -656,6 +656,7 @@ function jumpToUrl(URL) {
      */
     public function makeShortcutIcon($gvList, $setList, $modName, $motherModName = '')
     {
+        $gvList = 'route,' . $gvList;
         $storeUrl = $this->makeShortcutUrl($gvList, $setList);
         $pathInfo = parse_url(GeneralUtility::getIndpEnv('REQUEST_URI'));
         // Fallback for alt_mod. We still pass in the old xMOD... stuff, but TBE_MODULES only knows about "record_edit".