#103174CustomFileControlsEvent does not support javaScriptModules
Description
The event provides access to the `$resultArray` and allows to set a new version of that variable.
But the triggering code does not use the modified version.
That array holds a list of javaScriptModules to load. This info is not respected.
This worked prior the event when one used a UserFunction in order to add custom controls, as the resultArray was provided and could be handled as reference.
It seems I could fix this via:
diff --git a/typo3/sysext/backend/Classes/Form/Container/FilesControlContainer.php b/typo3/sysext/backend/Classes/Form/Container/FilesControlContainer.php
index c231c8d076..250e1b7e68 100644
--- a/typo3/sysext/backend/Classes/Form/Container/FilesControlContainer.php
+++ b/typo3/sysext/backend/Classes/Form/Container/FilesControlContainer.php
@@ -271,14 +271,15 @@ class FilesControlContainer extends AbstractContainer
}
}
- $controls = $this->eventDispatcher->dispatch(
+ $event = GeneralUtility::makeInstance(EventDispatcherInterface::class)->dispatch(
new CustomFileControlsEvent($resultArray, $table, $field, $row, $config, $formFieldIdentifier, $formFieldName)
- )->getControls();
+ );
+ $resultArray = $event->getResultArray();
- if ($controls !== []) {
+ if ($event->getControls() !== []) {
$view->assign('customControls', [
'id' => $formFieldIdentifier . '_customControls',
- 'controls' => implode("\n", $controls),
+ 'controls' => implode("\n", $event->getControls()),
]);
}
But then I end up with
Uncaught (in promise) Error: Unable to resolve specifier '@e2/e2-core/FilePathBasedBrowser/SearchForm.js' imported from http://localhost:8080/typo3/record/edit?token=a91f1f57ee42b3
I expect https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Breaking-98479-RemovedFileReferenceRelatedFunctionality.html to be the change that broke the feature.
Reviews 2
History 612
-
Daniel Siepmann changed description 02/22/24, 07:23
-
Daniel Siepmann changed description 02/22/24, 07:25
-
Gerrit Code Review pushed patch set 1 for main to change 83072 status
NewUnder Review 02/22/24, 07:30 -
Benjamin Franzke commented 02/22/24, 07:32
-
Daniel Siepmann commented 02/22/24, 07:35
Thanks Benjamin, that solves my issue.
-
Gerrit Code Review pushed patch set 2 for main to change 83072 02/22/24, 17:15
-
Gerrit Code Review pushed patch set 3 for main to change 83072 02/23/24, 07:32
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 83081 02/23/24, 09:21
-
Gerrit Code Review pushed patch set 2 for 12.4 to change 83081 02/23/24, 09:36
-
Gerrit Code Review pushed patch set 3 for 12.4 to change 83081 02/23/24, 09:59
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % 02/23/24, 12:25Applied in changeset commit:93b77f6d32ba653dcb8dd6f70373e9db6abe1a2c.
-
Benni Mack changed status
ResolvedClosed 07/09/24, 15:33
Thanks, I pushed a patch.
> But then I end up with
>You need to define
'tags' => [ 'backend.form' ]inConfiguration/JavaScriptModules.php. Please test with that.(Reason is that your JavaScript module is loaded as a result of a fetch-request, but the importmap needs to be prefilled with your imports in order for that to work – we can’t alter the importmap at runtime, therefore we introduced tags)