Project

General

Profile

Actions

Bug #96579

open

FLUIDTEMPLATE always uses default action to find the template

Added by Dmitry Dulepov over 2 years ago. Updated over 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2022-01-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:

Description

FLUIDTEMPLATE always uses default Extbase action to find the template even if you specify extbase.controllerActionName. Example:

        10 = FLUIDTEMPLATE
        10 {
          extbase {
            controllerActionName = logout
            controllerExtensionName = Felogin
            controllerName = Login
            pluginName = Login
          }

          settings < plugin.tx_felogin_login.settings

          templateRootPaths {
            10 = EXT:template/Resources/Private/Plugins/FeLogin/BoxTemplates/
          }

It will still render the login action.

Problem seems to be in FluidTemplateContentObject::renderFluidView(), which does not pass action name to the view as it should:

    protected function renderFluidView()
    {
        return $this->view->render();
    }

In the view:

    public function render($actionName = null)
    {
        $renderingContext = $this->getCurrentRenderingContext();
        $templateParser = $renderingContext->getTemplateParser();
        $templatePaths = $renderingContext->getTemplatePaths();
        if ($actionName) {
            $actionName = ucfirst($actionName);
            $renderingContext->setControllerAction($actionName);
        }

Here there will be no action, so rendering context will always contain default action for controller.

Also it is not worth trying templateName because it will not be used if there is Extbase controller & plugin specified. So there is no way to use any action except the default one.

The fix: pass action to the view.

Actions #1

Updated by Torben Hansen almost 2 years ago

I tested this in v12 main branch and can not even get the feature up and running with the provided code snippet. To me it seems this feature is broken (maybe since #93853 - just guessing).

The templateRootPaths data will currently only be assigned to the view, when also a templateName is set (see: https://github.com/TYPO3/typo3/blob/main/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php#L139).

However, when a templateName is set and $this->view->getRenderingContext()->setControllerAction($requestControllerActionName); is added after the setRequest() call in setExtbaseVariables, this seem to work.

Actions #2

Updated by Riccardo De Contardi over 1 year ago

Is this related #81099 or a different one?

Actions

Also available in: Atom PDF