Issue Bug Closed

#93759Fluid page module: not able to unset preview-header in "tt_content_drawItem" hook

Anonymous 03/17/21, 09:27 updated 09/17/21, 20:19

Description

The issue

This issue is about the new PreviewRenderer vs PageLayoutView.

Particularly this hook:

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawItem']

Here you have the hook called in the new StandardContentPreviewRenderer:

clipboard-202103171019-ddlyu.png

https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/backend/Classes/Preview/StandardContentPreviewRenderer.php#L97

But when you look closely, the argument-variable $hookPreviewContent is not previously defined.
So despite it is passed by reference, you end up modifying a variable in the hook-function – without any effect.

In comparison with the old PageLayoutView, you can see the difference:

https://github.com/TYPO3/TYPO3.CMS/blob/10.4/typo3/sysext/backend/Classes/View/PageLayoutView.php#L1221

clipboard-202103171017-kz2fv.png

The $outHeader is determined right before the hook.

When you step up you can see, that preview-header and preview-content are processed separately and preview-header is not further passed to renderPageModulePreviewContent so it may be manipulated in the “tt_content_drawitem”-hook as always before.

https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/backend/Classes/View/BackendLayout/Grid/GridColumnItem.php#L79

clipboard-202103171016-eq1bn.png

How to solve?

I can see the intent to separate preview-header from preview-content. It makes sense somehow.

But how can we restore the original behaviour of the hook? Or should it be restored at all? -> Refactoring the PreviewRendererInterface to provide an additional argument to “renderPageModulePreviewContent” may be a quick solution – but looks rather like a workaround.

Should we dispatch a PSR-14 event somwhere here to make modification of preview-header and preview-content possible again?

clipboard-202103171025-yhgwu.png

Reviews 0

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