Bug #103174
closedCustomFileControlsEvent does not support javaScriptModules
100%
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.
Updated by Gerrit Code Review 9 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83072
Updated by Benjamin Franzke 9 months ago · Edited
Thanks, I pushed a patch.
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
You need to define 'tags' => [ 'backend.form' ]
in Configuration/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)
Updated by Gerrit Code Review 9 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83072
Updated by Gerrit Code Review 9 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83072
Updated by Gerrit Code Review 9 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83081
Updated by Gerrit Code Review 9 months ago
Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83081
Updated by Gerrit Code Review 9 months ago
Patch set 3 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83081
Updated by Anonymous 9 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 93b77f6d32ba653dcb8dd6f70373e9db6abe1a2c.