evoWeb / recaptcha

TYPO3 Extension to make use of googles nocaptcha
GNU General Public License v2.0
6 stars 18 forks source link

Load ViewHelper by index (e.g., timestamp) #49

Closed rk-mxp closed 2 years ago

rk-mxp commented 2 years ago

Current behavior

The View Model isn't loaded with other form element extensions

Expected behavior/output

The ViewModel is always loaded

Steps to reproduce

Install another extension with a custom form element that loads its ViewModel without index, e.g., https://extensions.typo3.org/extension/form_country_select or https://extensions.typo3.org/extension/form_element_linked_checkbox

Environment

Possible Solution

Change

additionalViewModelModules:
  - 'TYPO3/CMS/Recaptcha/Backend/FormEditor/RecaptchaViewModel'

to

additionalViewModelModules:
  1647849522: 'TYPO3/CMS/Recaptcha/Backend/FormEditor/RecaptchaViewModel'

Important: Use a unique timestamp to prevent conflicts with other extensions.
Also don't do this inside a Yaml file that is imported by imports. It seems Symfony has a Bug because the Indexes get removed again. It has to be done in the main Yaml file imported by TypoScript.

Additional context

By adding the ViewModel without an index it gets added at index 0. Problem is, this is true for every other extension that adds ViewModels like this. This results in only a single ViewModel to be loaded, either the first or last extension (this I didn't check).

rk-mxp commented 2 years ago

The imports Bug is a Typo3 Bug, see https://forge.typo3.org/issues/94729

rk-mxp commented 2 years ago

What is the status of this issue? It creates conflicts with other extensions that add form elements.

garbast commented 2 years ago

Feel free to submit a pull request to speed things up.