Deprecation: #98431 - Replace requireJsModules in FormEngine resultArray

See forge#98431

Description

Loading JavaScript modules via $resultArray['requireJsModules'] has been deprecated in favor of a new generic key named 'javaScriptModules'.

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.

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.

The 'requireJsModules' key is deprecated.

Impact

Registering modules via :'requireJsModules' will still work. These modules will be loaded after modules registered via 'javaScriptModules'. Extensions that use 'requireJsModules will work as before but trigger a PHP E_USER_DEPRECATED error.

Affected installations

Installations that register custom FormEngine components with JavaScript modules.

Migration

Use the key 'javaScriptModules' and assign an instance of TYPO3\CMS\Core\Page\JavaScriptModuleInstruction:

// use TYPO3\CMS\Core\Page\JavaScriptModuleInstruction;
$resultArray['javaScriptModules'][] = JavaScriptModuleInstruction::create(
    '@my/extension/my-element.js'
);