Deprecation: #100887 - Deprecation of useNonce argument in f:asset:css and f:asset:script view helpers
See forge#100887
Description
The
use argument on the
f: and
f: ViewHelpers has been renamed to
csp to better
reflect its purpose (controlling Content-Security-Policy hash/nonce
collection rather than nonce usage specifically).
Similarly, the
'use asset option key accepted by
\TYPO3\ and
\TYPO3\ has been
replaced by
'csp'.
Impact
Passing
use as a ViewHelper argument or as an
Asset option key will trigger a deprecation-level log
entry in TYPO3 v14. These usages are scheduled for removal in TYPO3 v15.
Affected installations
Installations with Fluid templates using
<f:
or
<f:, and extensions calling
Asset or
Asset
with
['use.
Migration
Replace the
use argument with
csp in Fluid templates:
<!-- Before -->
<f:asset.script identifier="my-script"
src="EXT:my_ext/Resources/Public/JavaScript/foo.js"
useNonce="1" />
<!-- After -->
<f:asset.script identifier="my-script"
src="EXT:my_ext/Resources/Public/JavaScript/foo.js"
csp="1" />
Replace the
'use option key with
'csp' in PHP:
// Before
$assetCollector->addJavaScript('my-script', $src, [], ['useNonce' => true]);
// After
$assetCollector->addJavaScript('my-script', $src, [], ['csp' => true]);
The
Page methods
add,
add, and
add retain their
$use parameter names for backward compatibility; no migration is
required for callers of these methods.