Project

General

Profile

Actions

Feature #88811

open

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

Added by Dieter Porth over 5 years ago. Updated over 5 years ago.

Status:
New
Priority:
Could have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2019-07-21
Due date:
% Done:

0%

Estimated time:
PHP Version:
7.2
Tags:
Complexity:
Sprint Focus:

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;

Actions

Also available in: Atom PDF