Project

General

Profile

Actions

Bug #78276

open

Workspace preview "StageService.php" missing prev/next stage buttons

Added by Michael Schütz over 7 years ago. Updated 6 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Workspaces
Start date:
2016-10-13
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
workspace stage
Complexity:
Is Regression:
No
Sprint Focus:

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!


Files

stage-buttons.png (55.7 KB) stage-buttons.png Michael Schütz, 2016-10-13 10:42
Actions

Also available in: Atom PDF