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