Project

General

Profile

Actions

Bug #105325

open

Nested StandaloneView (FluidTemplate) inherits Extbase request from TemplateView

Added by Markus Klein 8 months ago. Updated 3 months ago.

Status:
Under Review
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2024-10-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Setup

Extbase Extension with a Controller "Seminars" and an action "Show".
The corresponding "Show.html" Fluid template contains:

<f:cObject typoscriptObjectPath="lib.someContent">

So it renders some regular content:


lib.someContent < styles.content.get
lib.someContent.select.pidInList = 123

The selected content contains an Extbase Plugin.

Expected behavior

Browser should display the content loaded via lib.someContent.
This works just fine up to v11.

Actual behavior

Exception that "Seminars/Show.html" can't be found in paths. (where the paths are the regular Fluid Styled Content paths)

Analysis

The Fluid template setup above creates technically a nesting of TemplateView (Show-Action) and StandaloneView (FluidTemplate via f:cObject).

Unluckily, the StandaloneView gets passed the Extbase-Request from the Show-Action, which causes this request being passed down to the TYPO3\CMS\Fluid\Core\Rendering\RenderingContext::setRequest causing the Controller/Action of the FluidTemplate to be overwritten.

While it is desirable that StandaloneView itself can handle Extbase Requests for other use cases like E-Mail and stuff, this should not be the case when an isolated context is required, like in the f:cObject case.

Ideas for solution

Fix CObjectViewHelper to "revert" the request properly, e.g. by using the initial requst from $GLOBALS[TYPO3_REQUEST] instead of the more specific one in its own renderingContext.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #104773: Implement and use a core ViewFactoryInterfaceClosed2024-08-29

Actions
Actions #1

Updated by Markus Klein 8 months ago

  • Description updated (diff)
Actions #2

Updated by Markus Klein 8 months ago · Edited

Probably better change in the viewhelper

- $request = $renderingContext->getRequest();
+ $request = $renderingContext->getRequest()->withoutAttribute('extbase');
Actions #3

Updated by Garvin Hicking 8 months ago

  • Related to Feature #104773: Implement and use a core ViewFactoryInterface added
Actions #4

Updated by Markus Klein 8 months ago

The fix above works for v12, I'll try to do some testing in v13 too.

Actions #5

Updated by Gerrit Code Review 8 months ago

  • Status changed from New to Under Review

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86633

Actions #6

Updated by Gerrit Code Review 8 months ago

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86828

Actions #7

Updated by Gerrit Code Review 8 months ago

Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86633

Actions #8

Updated by Markus Klein 3 months ago

  • Description updated (diff)
Actions #10

Updated by Markus Klein 3 months ago

The content of this issue evolved over time, I'll try to provide a new warp up.

Actions #11

Updated by Markus Klein 3 months ago · Edited

This issue is only present in v12. To reproduce:

  1. Install ext:news
  2. Install ext:plain_faq (or any other extbase-based extension)
  3. Install fluid_styled_content
  4. Add necessary base TS templates (FSC, news, plain_faq)
  5. Configure a default extension name for FSC in TypoScript: lib.contentElement.extbase.controllerExtensionName = Sitesetup
  6. Create a sysfolder "data"
  7. Create 1 FAQ record
  8. Create 1 News record: Add a content element there with the plainfaq list plugin (select storage folder "data")
  9. Add "news detail" plugin to a page and select the created news article there
  10. View the page

The error will be:

#1257246929 TYPO3Fluid\Fluid\View\Exception\InvalidTemplateResourceException
Tried resolving a template file for controller action "News->detail" in format ".html", but none of the paths contained the expected template file (News/Detail.html). The following paths were checked: /var/www/html/vendor/typo3/cms-fluid-styled-content/Resources/Private/Templates/, /var/www/html/vendor/reelworx/sitesetup/Resources/Private/Templates/Content/

Note: This error does not occur if lib.contentElement.extbase.controllerExtensionName is NOT set!

(The code is gone in v13 with https://review.typo3.org/c/Packages/TYPO3.CMS/+/85348/3/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php#b219. Code-wise v13 still passes along the "extbase-enriched" request through the cObject-ViewHelper, but it won't matter here.)

Actions #12

Updated by Gerrit Code Review 3 months ago

Patch set 3 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86633

Actions #13

Updated by Gerrit Code Review 3 months ago

Patch set 4 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/86633

Actions

Also available in: Atom PDF