Project

General

Profile

Actions

Bug #85710

closed

tx_form: Multiple Extensions with YAML additionalViewModel overwrite configuration array

Added by David Bascom over 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Form Framework
Target version:
-
Start date:
2018-08-01
Due date:
% Done:

100%

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

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'

Actions #1

Updated by Steffen Gebert over 6 years ago

Hi,

sorry, this is the bug tracker of the bug tracker..

Actions #2

Updated by Steffen Gebert over 6 years ago

  • Project changed from 9 to TYPO3 Core
  • Category deleted (Development)
  • TYPO3 Version set to 8
Actions #3

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);
}
Actions #4

Updated by Riccardo De Contardi over 6 years ago

  • Category set to Form Framework
Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

Updated by Ralf Zimmermann about 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF