[BUGFIX] Add returnUrl to records opened by EXT:opendocs 57/49657/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Mon, 29 Aug 2016 15:35:00 +0000 (17:35 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 30 Aug 2016 14:26:00 +0000 (16:26 +0200)
If a record that was opened by the opendocs menu gets closed, the user
now gets the record list of the record's pid.

Resolves: #77675
Releases: master, 7.6
Change-Id: I90014ea639ce191ad0ee2d1a1cd650d2aaaebc52
Reviewed-on: https://review.typo3.org/49657
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php

index 180f529..b76fcb0 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Opendocs\Backend\ToolbarItems;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
 use TYPO3\CMS\Core\Page\PageRenderer;
@@ -144,14 +145,16 @@ class OpendocsToolbarItem implements ToolbarItemInterface
     {
         $table = $document[3]['table'];
         $uid = $document[3]['uid'];
-        $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid);
+        $record = BackendUtility::getRecordWSOL($table, $uid);
         if (!is_array($record)) {
             // Record seems to be deleted
             return '';
         }
         $label = htmlspecialchars(strip_tags(htmlspecialchars_decode($document[0])));
         $icon = $this->iconFactory->getIconForRecord($table, $record, Icon::SIZE_SMALL)->render();
-        $link = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('record_edit') . '&' . $document[2];
+        $link = BackendUtility::getModuleUrl('record_edit')
+            . '&' . $document[2]
+            . '&returnUrl=' . rawurlencode(BackendUtility::getModuleUrl('web_list') . '&id=' . (int)$document[3]['pid']);
         $pageId = (int)$document[3]['uid'];
         if ($document[3]['table'] !== 'pages') {
             $pageId = (int)$document[3]['pid'];