Project

General

Profile

Actions

Bug #89445

closed

FooterAsset are not loaded

Added by Michal Majernik over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Category:
Content Rendering
Target version:
-
Start date:
2019-10-18
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
footer assets, fluid
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Assets in the FooterAssets section are no longer rendered.

How to reproduce:

Create a simple indexAction, Index.html template and a simple js file (i.e. feature.js)

When you add FooterAssets section into your Index.html template as follows:

<f:section name="FooterAssets">
    <script type="application/javascript" src="{f:uri.resource(path:'JavaScript/feature.js', extensionName: 'MyExtension')}"></script>
</f:section>

then this javascipt won't be rendered


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Feature #88689: Support for system-wide class dependency injection, PSR-11Closed2019-07-05

Actions
Related to TYPO3 Core - Bug #68061: Ensure PageRenderer singleton is setClosed2015-07-12

Actions
Related to TYPO3 Core - Bug #87402: Feature-79409 renderAssetsForRequest does not work for USER_INT/uncachedClosed2019-01-11

Actions
Actions #1

Updated by Daniel Goerz over 4 years ago

  • Status changed from New to Accepted
  • Is Regression set to Yes

Hi Michal,
thanks for reporting. I could verify the issue.

It seems related to the newly introduced Dependency Injection and the initialization of the PageRenderer class in the ActionController.

If you need a quick fix, you can override the method in your controller with the following:

protected function renderAssetsForRequest($request)
{
    if (!$this->view instanceof TemplateView) {
        return;
    }
    $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
    $variables = ['request' => $request, 'arguments' => $this->arguments];
    $headerAssets = $this->view->renderSection('HeaderAssets', $variables, true);
    $footerAssets = $this->view->renderSection('FooterAssets', $variables, true);
    if (!empty(trim($headerAssets))) {
        $pageRenderer->addHeaderData($headerAssets);
    }
    if (!empty(trim($footerAssets))) {
        $pageRenderer->addFooterData($footerAssets);
    }
}
Actions #2

Updated by Benjamin Franzke over 4 years ago

  • Assignee set to Benjamin Franzke
Actions #3

Updated by Daniel Goerz over 4 years ago

After talking to Benjamin we figured out, that indeed makeInstance and OM->get() return different objects here

$pageRenderer = $this->objectManager->get(PageRenderer::class);
spl_object_id($pageRenderer); // 946
spl_object_hash($pageRenderer); // 000000002101b3d70000000020f34487
$pageRenderer2 = GeneralUtility::makeInstance(PageRenderer::class);
spl_object_id($pageRenderer2); // 1045
spl_object_hash($pageRenderer2); // 000000002101b3d70000000020f34487

The reason is that TSFE sets a PageRendererInstance via setSingletonInstance() which is then only respected by instantiantion via GU::makeInstance().
The symfony DI container and therefore the ObjectManager do not now anything about this singleton cache.

The goal is to remove setSingletonInstance() from usage outside of tests completely.

Actions #4

Updated by Daniel Goerz over 4 years ago

  • Related to Feature #88689: Support for system-wide class dependency injection, PSR-11 added
Actions #5

Updated by Daniel Goerz over 4 years ago

  • Related to Bug #68061: Ensure PageRenderer singleton is set added
Actions #6

Updated by Gerrit Code Review over 4 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62033

Actions #7

Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62033

Actions #8

Updated by Daniel Goerz over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Daniel Goerz over 4 years ago

  • Related to Bug #87402: Feature-79409 renderAssetsForRequest does not work for USER_INT/uncached added
Actions #10

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF