Bug #85710
closedtx_form: Multiple Extensions with YAML additionalViewModel overwrite configuration array
100%
Description
We have an Typo3 8.7.17 installation with two custom extensions.
Both extensions extend the tx_form with a custom formelement and add a JS-module using the additionalViewModelModules in YAML.
Only the additionalViewModelModules array of the last extension is respected and loads the JS-modules from ...Resources/Public/JavaScript/Backend/FormEditor/...
This results in an empty backend-preview for the formelement of the first extension.
The FormEditorSetup.yaml of the first extension:
TYPO3: CMS: Form: prototypes: standard: formEditor: dynamicRequireJsModules: additionalViewModelModules: - 'TYPO3/CMS/Nnscouts/Backend/FormEditor/NnscoutsViewmodel'
The FormEditorSetup.yaml of the second extension:
TYPO3: CMS: Form: prototypes: standard: formEditor: dynamicRequireJsModules: additionalViewModelModules: - 'TYPO3/CMS/Dsgvo/Backend/FormEditor/DsgvoViewModel'
Reason seems to be that the merge of the arrays from additionalViewModelModules fails: Actually it is not merged, but the array of ext2 replaces the array of ext1 – or in other words: by the extension that was loaded last.
We made sure, that both YAML-configurations are loaded correctly and the JS-files are at the right place.
Removing the dynamicRequireJsModules-section from the second extension and adding a additional item to the array of the first extension – and vice versa – works:
TYPO3: CMS: Form: prototypes: standard: formEditor: dynamicRequireJsModules: additionalViewModelModules: - 'TYPO3/CMS/Dsgvo/Backend/FormEditor/DsgvoViewModel' - 'TYPO3/CMS/Nnscouts/Backend/FormEditor/NnscoutsViewmodel'
Updated by Steffen Gebert over 6 years ago
Hi,
sorry, this is the bug tracker of the bug tracker..
Updated by Steffen Gebert over 6 years ago
- Project changed from 9 to TYPO3 Core
- Category deleted (
Development) - TYPO3 Version set to 8
Updated by Julian Wundrak over 6 years ago
I can reproduce this behavior in TYPO3 9.3.3.
My temporary solution is using keys, like:
TYPO3:
CMS:
Form:
prototypes:
standard:
formEditor:
dynamicRequireJsModules:
additionalViewModelModules:
0: 'TYPO3/CMS/Dsgvo/Backend/FormEditor/DsgvoViewModel'
1: 'TYPO3/CMS/Nnscouts/Backend/FormEditor/NnscoutsViewmodel'
Notice, that the keys are successive. Else additionalViewModelModules
is an object instead of an array, and this crashes here: Resources/Public/JavaScript/Backend/FormEditor.js:FromEditor::_viewSetup()
I believe, it is not so easy to not allow 'merging' this configuration, so maybe it would be easier to allow objects in additionalViewModelModules.
To use
additionalViewModelModules:
10: '...'
20: '...'
i using this patch for the _viewSetup()
-Method
if (!getUtility().isUndefinedOrNull(additionalViewModelModules)) {
if ('object' === $.type(additionalViewModelModules)) {
additionalViewModelModules = Object.values(additionalViewModelModules);
}
assert('array' === $.type(additionalViewModelModules), 'Invalid parameter "additionalViewModelModules"', 1475379752);
}
Updated by Gerrit Code Review about 6 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58106
Updated by Gerrit Code Review about 6 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58106
Updated by Gerrit Code Review about 6 years ago
Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/58768
Updated by Ralf Zimmermann about 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6939d0dae3c0f5c2209dbbd6ad82e02fbab0ebfa.