Project

General

Profile

Actions

Bug #92409

open

Regression with Save and Preview Button

Added by Felix Jacobi about 4 years ago. Updated over 2 years ago.

Status:
Accepted
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
-
Start date:
2020-09-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hej,

I stumbled onto this yesterday when trying to configure multiple save and preview buttons for different folders and noticed that the links weren't constructed properly, i.e. only no_cache parameter was created.
After debugging this I found a regression here, introduced back in 2018. Line numbers are from v9.5.21, but are also found in v10.

typo3/sysext/backend/Classes/Controller/EditDocumentController.php#1040

$previewConfiguration = BackendUtility::getPagesTSconfig($previewPageId)['TCEMAIN.']['preview.'][$table . '.'] ?? [];

The PageTS is fetched from the target page, i.e. the detail page and not the current backend folder the user is in.
Via git blame I found this review: https://review.typo3.org/c/Packages/TYPO3.CMS/+/56693/36/typo3/sysext/backend/Classes/Controller/EditDocumentController.php#b960

With a small change (I'm not sure if this is the best way to access the current page id in this context) it is working again:

$previewConfiguration = BackendUtility::getPagesTSconfig($this->pageinfo['uid'])['TCEMAIN.']['preview.'][$table . '.'] ?? [];

This might be an issue for pages, since that needed a switch before? Not 100% sure about that, because pages preview worked fine with my change.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #89263: TCEMAIN.preview doesn't work for routed controller with empty argumentsClosed2019-09-25

Actions
Related to TYPO3 Core - Bug #96667: Save and preview button uses wrong pagetsClosed2022-01-28

Actions
Actions #1

Updated by Felix Jacobi about 4 years ago

  • Related to Bug #89263: TCEMAIN.preview doesn't work for routed controller with empty arguments added
Actions #2

Updated by Georg Ringer about 4 years ago

  • Status changed from New to Accepted

IMO this can't be backported because of highly breaking - even though totally valid

Actions #3

Updated by Jo Hasenau about 4 years ago

So basically it is enough for a proper workaround to put the TSconfig on both, source and target page or put it even some levels lower - maybe on the root page.
So thanks a lot for this ticket, since it finally brought us a solution after quite some time of analysis and searching.

Actions #4

Updated by Anonymous over 3 years ago

Jo Hasenau wrote in #note-3:

So basically it is enough for a proper workaround to put the TSconfig on both, source and target page or put it even some levels lower - maybe on the root page.
So thanks a lot for this ticket, since it finally brought us a solution after quite some time of analysis and searching.

Thanks, stumbled upon this problem too. Glad to find this issue with a workaround.

Why the proposed change by OP is addressed as "highly breaking" by Georg?

Actions #5

Updated by Philipp Kitzberger almost 3 years ago

  • Related to Bug #96667: Save and preview button uses wrong pagets added
Actions #6

Updated by Marc Bastian Heinrichs over 2 years ago

Stumbled over this issue upgrading a project from v8 to v10.

IMO using the previewPageId instead of the current page is a bug, changing a former behavior and needs to be fixed.

If I get it right using the previewPageId fetching the previewConfiguration makes not sense, having the tsconfig in files.
Because one has no chance to change the configuration using a condition.

Assuming the default configuration

TCEMAIN.preview.tx_news_domain_model_news.previewPageId = 23

and for news from folder foo the page 42 should be used for preview.
Normally one would use
[page["uid"] == foo]
TCEMAIN.preview.tx_news_domain_model_news.previewPageId = 42
[global]

This doesn't work anymore.

But this won't work either, since it is a hen egg problem.

[page["uid"] == 42]
TCEMAIN.preview.tx_news_domain_model_news.previewPageId = 42
[global]

The only chance would be to place this configuration change in the tsconfig field on page 42.
I guess this is why Georg called it highly breaking.

So the only way to fix this non breaking would be another setting activating the former behavior, right?

Actions #7

Updated by Marc Bastian Heinrichs over 2 years ago

Ah, ok the hen egg problem could be fixed using

[page["uid"] in [foo,42]]
TCEMAIN.preview.tx_news_domain_model_news.previewPageId = 42
[global]

because the PreviewPageId is fetched using currentPageId.

The need to configure it like this seems weird to me.

Actions #8

Updated by Felix Nagel over 2 years ago

Confirmed for TYPO3 10.4.28 with EXT:news 8.6.0. Using TSconfig on root or on both, sys folder with records AND the preview page works.

Actions

Also available in: Atom PDF