Project

General

Profile

Actions

Bug #102111

open

javaScriptModules in custom FormElement not loading, when field is located in IRRE

Added by Armin Vieweg 7 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-10-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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.

No data to display

Actions

Also available in: Atom PDF