[BUGFIX] Preview of moved workspace elements on source page 74/30474/2
authorOliver Hader <oliver@typo3.org>
Wed, 28 May 2014 13:42:21 +0000 (15:42 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Tue, 17 Jun 2014 13:00:24 +0000 (15:00 +0200)
If e.g. a content element gets moved to a different page, the
workspace preview link opens the source page (which does not
contain the element anymore, because it was moved).

Since the elements are shown on the correct page in the
workspace backend module, using the target page in the preview
link for the frontend is just obvious.

Resolves: #59143
Releases: 6.2
Change-Id: Ib84e65766e825cc26a66cbda9ffa8132c3a3ec18
Reviewed-on: https://review.typo3.org/30474
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/workspaces/Classes/Service/WorkspaceService.php

index da98278..3adfb30 100644 (file)
@@ -528,7 +528,11 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
                        if ($versionRecord === NULL) {
                                $versionRecord = BackendUtility::getRecord($table, $uid);
                        }
+                       if (VersionState::cast($versionRecord['t3ver_state'])->equals(VersionState::MOVE_POINTER)) {
+                               $movePlaceholder = BackendUtility::getMovePlaceholder($table, $liveRecord['uid'], 'pid');
+                       }
 
+                       $previewPageId = (empty($movePlaceholder['pid']) ? $liveRecord['pid'] : $movePlaceholder['pid']);
                        $additionalParameters = '&tx_workspaces_web_workspacesworkspaces[previewWS]=' . $versionRecord['t3ver_wsid'];
 
                        $languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
@@ -536,7 +540,7 @@ class WorkspaceService implements \TYPO3\CMS\Core\SingletonInterface {
                                $additionalParameters .= '&L=' . $versionRecord[$languageField];
                        }
 
-                       $viewUrl = BackendUtility::viewOnClick($liveRecord['pid'], '', '', '', '', $additionalParameters);
+                       $viewUrl = BackendUtility::viewOnClick($previewPageId, '', '', '', '', $additionalParameters);
                } else {
                        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['workspaces']['viewSingleRecord'])) {
                                $_params = array(