TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:09 +02:00
commit af8cc155b5
6818 changed files with 642608 additions and 0 deletions
@@ -0,0 +1,77 @@
.. include:: /Includes.rst.txt
.. _feature-107056-1753012116:
==================================================================
Feature: #107056 - Introduce headerData and footerData ViewHelpers
==================================================================
See :issue:`107056`
Description
===========
Two new Fluid ViewHelpers have been introduced to allow injecting arbitrary
content into the HTML :php:`<head>` or before the closing :php:`</body>` tag
of a rendered page:
* :php:`<f:page.headerData>` - injects content into the :php:`<head>` section
* :php:`<f:page.footerData>` - injects content before the closing :php:`</body>` tag
The ViewHelpers internally use the :php-short:`\TYPO3\CMS\Core\Page\PageRenderer`
API and are useful when existing ViewHelpers such as
:php:`<f:asset.css>` or :php:`<f:asset.script>` do not support all required
attributes or use cases (for example, :php:`dns-prefetch`, :php:`preconnect`,
tracking scripts, or inline JavaScript).
Example usage for :php:`<f:page.headerData>`:
.. code-block:: html
<f:page.headerData>
<link
rel="preload"
href="/fonts/myfont.woff2"
as="font"
type="font/woff2"
crossorigin="anonymous"
>
<link rel="dns-prefetch" href="//example-cdn.com">
<link rel="preconnect" href="https://example-cdn.com">
</f:page.headerData>
Example usage for :php:`<f:page.footerData>`:
.. code-block:: html
<f:page.footerData>
<script>
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u = "https://your-matomo-domain.example.com/";
_paq.push(['setTrackerUrl', u + 'matomo.php']);
_paq.push(['setSiteId', '1']);
var d = document,
g = d.createElement('script'),
s = d.getElementsByTagName('script')[0];
g.async = true;
g.src = u + 'matomo.js';
s.parentNode.insertBefore(g, s);
})();
</script>
</f:page.footerData>
Both ViewHelpers output the given content as-is. Any user-supplied input passed
to these ViewHelpers must be escaped manually to prevent Cross-Site Scripting
(XSS) vulnerabilities.
Impact
======
Extension authors and integrators can now use the new ViewHelpers to add raw
HTML content, such as :php:`<link>` or :php:`<script>` tags, directly into
the rendered page output.
.. index:: Fluid, ext:fluid