Bug #102111
openjavaScriptModules in custom FormElement not loading, when field is located in IRRE
0%
Description
In my DCE extension I got a bug report, that my custom code field is not working (JS is not loading),
when the first occurrence is located inside an IRRE field (type: inline).
Original issue: https://github.com/a-r-m-i-n/dce/issues/86
This is how I add the JS module, in my custom FormElement:
$resultArray['javaScriptModules'][] = JavaScriptModuleInstruction::create('@t3/dce/code-editor');
When this custom field is located in the form being displayed, everything works fine, also for fields which get loaded asynchronously inside the IRRE elements afterwards.
But when it is not located on the initial form, the JS console in browser complains, in the moment when you open an IRRE element containing this custom FormElement:
Unable to resolve specifier '@t3/dce/code-editor'
To solve the issue for my users, I've added an AfterFormEnginePageInitializedEventListener
which adds the JavaScript module always (for DCE records). See: https://github.com/a-r-m-i-n/dce/blob/master/Classes/EventListener/AfterFormEnginePageInitializedEventListener.php#L23
But I guess this is a core issue and JavaScript modules called from FormElements inside an IRRE element should also get loaded, without such workaround.