Bug #89445
closedFooterAsset are not loaded
100%
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
Updated by Daniel Goerz about 5 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); } }
Updated by Daniel Goerz about 5 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.
Updated by Daniel Goerz about 5 years ago
- Related to Feature #88689: Support for system-wide class dependency injection, PSR-11 added
Updated by Daniel Goerz about 5 years ago
- Related to Bug #68061: Ensure PageRenderer singleton is set added
Updated by Gerrit Code Review about 5 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
Updated by Gerrit Code Review about 5 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
Updated by Daniel Goerz about 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset cffb6e0fc6b4664dab7bd1838da6125787fffc26.
Updated by Daniel Goerz about 5 years ago
- Related to Bug #87402: Feature-79409 renderAssetsForRequest does not work for USER_INT/uncached added
Updated by Benni Mack almost 5 years ago
- Status changed from Resolved to Closed