Issue Feature Closed

#88811Allow the use of variable from a actioncontroller in section "headerAssets" and "footerAssets"

Dieter Porth 07/21/19, 14:29 updated 03/31/25, 18:28

Description

I want to use the variable of my controller-action in a footerAssets-section in my template. I need it to generate a page-specific javascript-code.

<f:section name="FooterAssets">
    <footer>
        <f:debug>{pageTest}</f:debug>
        <f:render section="debugFooterAssets"
                  arguments="{pageTest:pageTest}"
        />
    </footer>
</f:section>

The variables of the action are not avaiable in this special sections.
The solution of the problem seems to need only a change in typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php. in line 196 (TYPO3 9.5.8)

        // old version 
        $variables = ['request' => $request, 'arguments' => $this->arguments];
        // suggested solution 
        $variables = $this->view->getRenderingContext()->getVariableProvider()->getAll();
        $variables['request'] = $request;
        $variables['arguments'] = $this->arguments;

Reviews 0

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