Project

General

Profile

Actions

Bug #60213

closed

pageRenderer->addJsFooterFile doesn't work as expected

Added by Bernhard Kraft almost 10 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2014-07-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When using "addJsFooterFile" to add JS files to a backend module this doesn't work as expected.
The reason for this is located in backend/Classes/Template/DocumentTemplate.php @ line 910 and 914
(https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/backend/Classes/Template/DocumentTemplate.php#l910)

The pageRenderer method "render" is called twice. Once for rendering the header and a second time for rendering the footer. But inside the render method the internal "jsFiles" and all other variables get reset:
https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/core/Classes/Page/PageRenderer.php#l1943

It is stated, that the pageRenderer needs a full reset after each rendering - but it is not stated why this full reset is needed.

I created a patch which disables the reset via an argument to ->render method. This did not show any side effects for a few short tests.


Files

patch_60213.diff (2.24 KB) patch_60213.diff Bernhard Kraft, 2014-07-09 18:47

Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #57920: PageRenderer do not unset() class membersClosed2014-04-15

Actions
Related to TYPO3 Core - Bug #57294: pageRenderer was resetted after render callClosed2014-03-25

Actions
Related to TYPO3 Core - Task #58581: Clarify reset in page renderer commentClosed2014-05-06

Actions
Actions #1

Updated by Bernhard Kraft almost 10 years ago

Maybe this issue is related to the same problem in FE context. This problem exists in frontend when using ->addJsFooterFile() from within an USER_INT object:

http://www.typo3.net/forum/thematik/zeige/thema/109987/?show=1

The problem is also mentioned here:
https://github.com/ohader/extbase_upload/blob/master/Classes/ViewHelpers/Controller/JQueryController.php#L217
http://typo3.3.n7.nabble.com/addJsFooterFile-not-working-in-BE-but-addJsFile-does-td253239.html

Actions #2

Updated by Bernhard Kraft almost 10 years ago

Attached a patch. Gerrit is not working currently.

Actions #3

Updated by Markus Klein almost 10 years ago

Bernhard, we already removed this reset in Core, but had to revert that patch, as it breaks the RSA auth for BE login.

Actions #4

Updated by Markus Klein almost 10 years ago

see: #57920

Actions #5

Updated by Mathias Schreiber over 8 years ago

  • Target version deleted (next-patchlevel)
Actions #6

Updated by Markus Klein over 8 years ago

  • Status changed from New to On Hold

Still an issue? (Also in 7?)

Actions #7

Updated by Markus Klein about 8 years ago

  • Status changed from On Hold to Needs Feedback
Actions #8

Updated by Markus Klein about 8 years ago

Known issue, not solvable currently. See also comment in the code itself:
https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Page/PageRenderer.php#L1808

Actions #9

Updated by Markus Klein about 8 years ago

  • Status changed from Needs Feedback to Accepted
Actions #10

Updated by Markus Klein about 8 years ago

See also #58581

Actions #11

Updated by Markus Klein about 8 years ago

Only BE modules are affected. A possible workaround for CMS 7+ is:

The BE module has to use the ModuleTemplate class (instead of the DocumentTemplate) and has to use a Fluid template therefore.
In the Fluid template you can write a view helper, which calls the addJsFooterFile() method.

Background: In case of the ModuleTemplate, the HEADER part is rendered before the Fluid template is rendered, hence the PageRenderer is already reset and the newly added JS files should be adhered in the subsequent rendering of the FOOTER part.

Actions #12

Updated by Benni Mack over 3 years ago

  • Status changed from Accepted to Closed

Closing this issue now. we've solved this issue in TYPO3 v10 by not having DocumentTemplate anymore. in TYPO3 v11 the ModuleTemplate is called once now, however.

Using a ViewHelper to add a JS Footer File should be done since TYPO3 v10 with the <f:asset.js> which adds the content to the footer in BE or FE.

Actions

Also available in: Atom PDF