Issue Bug Accepted Orphaned

#92409Regression with Save and Preview Button

Felix Jacobi 09/25/20, 12:21 updated 05/30/22, 15:48

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.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Regression with Save and Preview Button Resolves: #92409 Releases: main