Bug #78276

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

Added by Michael Schütz over 2 years ago. Updated about 2 months ago.

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

0%

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!

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

History

#1 Updated by Michael Schütz over 2 years ago

  • Subject changed from Workspace preview "StageService.php" prev or next stage to Workspace preview "StageService.php" missing prev or next stage buttons

#2 Updated by Michael Schütz over 2 years ago

  • File stage-buttons.png View added
  • Subject changed from Workspace preview "StageService.php" missing prev or next stage buttons to Workspace preview "StageService.php" missing prev/next stage buttons

#3 Updated by Michael Schütz over 2 years ago

  • File deleted (stage-buttons.png)

#4 Updated by Benni Mack about 2 months ago

  • Target version changed from next-patchlevel to Candidate for patchlevel

Also available in: Atom PDF