#78276Workspace preview "StageService.php" missing prev/next stage buttons
Description
Hello everybody! I’am new to forge and hope I placed my first issue currectly. If not, give me a hint! Thank you!
The following I found. If I change content in workspace of a table which is not “tt_content”, “pages”, “pages_language_overlay” the stage buttons don’t show up in the preview. I found the reason for that in the files PreviewController.php, ActionHandler.php. In this files there is called the methods “getPreviousStageForElementCollection” and “getNextStageForElementCollection” of file StageService.php but only with the first parameter array “$workspaceItems”. The methods offer a second parameter array “$byTableName” to hand over the table-name where the “$workspaceItems” relate to. The second parameter array is prefilled with the tables “tt_content”, “pages”, “pages_language_overlay”. But if I have a “tt_news” record for example, the stage could not be determined and the buttons stay hidden.
Currently the methods are called like that without the second parameter:
$this->stageService->getNextStageForElementCollection($workspaceItemsArray);
$this->stageService->getPreviousStageForElementCollection($workspaceItemsArray);
I changed it for testing in this way and it works:
if (!empty($workspaceItemsArray)) {
list(, $nextStage) = $this->stageService->getNextStageForElementCollection($workspaceItemsArray, [key($workspaceItemsArray)]);
list(, $previousStage) = $this->stageService->getPreviousStageForElementCollection($workspaceItemsArray, [key($workspaceItemsArray)]);
} else {
list(, $nextStage) = $this->stageService->getNextStageForElementCollection($workspaceItemsArray);
list(, $previousStage) = $this->stageService->getPreviousStageForElementCollection($workspaceItemsArray);
}
If the array “$workspaceItemsArray” is filled, the root-keys are the table-names. So with “[key($workspaceItemsArray)]” I could hand over the table-name and the stage-buttons appear. If you use the discard-button, the array “$workspaceItemsArray” styes empty. For that reason I put the calls into an if/else and call it once with the second parameter and in the otherway without.
I tested it and can’t get any problems so far. Could somebody more experienced with the workspace please check my solution. And would it be possible to correct the behaviour in next TYPO3-Update?
Maybe a better solution could be to prefill the second-parameter array “$byTableName” globaly with all table-names which offer the use of workspace.
foreach ($tables as $key => $table) {
if ($table offers workspace usage) {
$this->byTableName[] = $table->getTableName();
}
}
Good times!
Reviews 2
Files 1
History 712
-
Michael Schütz changed subject
Workspace preview "StageService.php" prev or next stageWorkspace preview "StageService.php" missing prev or next stage buttons <span data-processor="relativetime" data-value="2016-10-13T10:39:26+00:00" > 10/13/16, 10:39 </span> -
Michael Schütz changed attached stage-buttons.png subject
Workspace preview "StageService.php" missing prev or next stage buttonsWorkspace preview "StageService.php" missing prev/next stage buttons <span data-processor="relativetime" data-value="2016-10-13T10:42:38+00:00" > 10/13/16, 10:42 </span> -
Michael Schütz changed
stage-buttons.png<span data-processor="relativetime" data-value="2016-10-13T10:42:50+00:00" > 10/13/16, 10:42 </span> -
Benni Mack changed target version <span data-processor="relativetime" data-value="2019-04-17T23:40:59+00:00" > 04/17/19, 23:40 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 92358 status
NewUnder Review <span data-processor="relativetime" data-value="2026-01-16T21:46:36+00:00" > 01/16/26, 21:46 </span> -
Gerrit Code Review pushed patch set 2 for main to change 92358 <span data-processor="relativetime" data-value="2026-04-21T15:20:09+00:00" > 04/21/26, 15:20 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 92358 <span data-processor="relativetime" data-value="2026-04-22T06:55:29+00:00" > 04/22/26, 06:55 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 92358 <span data-processor="relativetime" data-value="2026-04-28T15:49:38+00:00" > 04/28/26, 15:49 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 94566 <span data-processor="relativetime" data-value="2026-06-24T12:03:28+00:00" > 06/24/26, 12:03 </span>
-
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-06-24T12:05:27+00:00" > 06/24/26, 12:05 </span>Applied in changeset commit:c505bc45df6795daf1bd9556f122fbec251bc94d.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-08-11T08:46:34+00:00" > 08/11/26, 08:46 </span>
I guess the main issue here is that we preview a page with e.g. a news record but the news record is on a different page / storage page.