Feature: #98431 - Support javaScriptModules in FormEngine resultArray
See forge#98431
Description
The ability for custom Form
components to load JavaScript modules
via instances of \TYPO3\
is now
streamlined to use a new, generic $result
key named
'java
. The behaviour is otherwise identical to the
functionality that has been available via 'require
,
but the new name reflects that not just RequireJS modules may be loaded,
but also newer, native ECMAScript v6 JavaScript modules.
Using 'java
is now the suggested to be used over
'require
, as this latter is deprecated from now on
and will be removed in TYPO3 v13.
Impact
FormEngine components now use the key 'java
which
expects an instance of \TYPO3\
to be passed as value.
Example JavaScript module registration:
// use TYPO3\CMS\Core\Page\JavaScriptModuleInstruction;
$resultArray['javaScriptModules'][] = JavaScriptModuleInstruction::create(
'@my/extension/my-element.js'
);