Issue Bug Resolved

#96579FLUIDTEMPLATE always uses default action to find the template

Dmitry Dulepov 01/19/22, 10:32 updated 10/16/26, 14:30

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.

Reviews 2

History 47

  1. Torben Hansen commented <span data-processor="relativetime" data-value="2022-06-27T05:36:59+00:00" > 06/27/22, 05:36 </span>

    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.

  2. Riccardo De Contardi commented <span data-processor="relativetime" data-value="2022-09-25T08:12:51+00:00" > 09/25/22, 08:12 </span>

    Is this related #81099 or a different one?

  3. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-16T14:30:18+00:00" > 10/16/26, 14:30 </span>

    Applied in changeset commit:681bd7220242fb7765c42307c60b35dd2f138946.