Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Backend summary output settings are merged #4183

Open
ayacoo opened this issue Oct 8, 2024 · 7 comments
Open

[BUG] Backend summary output settings are merged #4183

ayacoo opened this issue Oct 8, 2024 · 7 comments
Assignees

Comments

@ayacoo
Copy link
Contributor

ayacoo commented Oct 8, 2024

Describe the bug
If you create several result plugins on a TYPO3 page with different settings, then these settings are merged down in the backend output for the plugins and thus output incorrectly.

This file is the trigger: https://github.com/TYPO3-Solr/ext-solr/blob/main/Classes/Backend/SettingsPreviewOnPlugins.php

Here $this->settings is used, which would probably have to be reset with __invoke.
Alternatively, you can also add an intermediate level to $this->settings: $this->settings[$this->pluginsTtContentRecord['uid']]

To Reproduce
Steps to reproduce the behavior:

  1. Create two result plugins with different settings on one TYPO3 page

Used versions (please complete the following information):

  • TYPO3 Version: 12.4.21
  • EXT:solr Version: 12.0.5
  • PHP Version: 8.3
@dkd-kaehm
Copy link
Collaborator

dkd-kaehm commented Oct 8, 2024

@ayacoo
Thanks for reporting that issue.
Could you provide a PR, against release-12.0.x branch?

@dkd-kaehm
Copy link
Collaborator

dkd-kaehm commented Oct 8, 2024

That is strange, SettingsPreviewOnPlugins is not a singleton, therefore is it a TYPO3 Core bug?

OK, that is defined in Services.yaml:

# BE modules, plugins
ApacheSolrForTypo3\Solr\Backend\SettingsPreviewOnPlugins:
arguments:
$flexFormService: '@TYPO3\CMS\Core\Service\FlexFormService'
tags:
- name: event.listener
identifier: 'solr.plugin.be.settings.preview'
event: TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent
# END: BE modules

Is there a way to set DI to always deliver new instances?

@ayacoo
Copy link
Contributor Author

ayacoo commented Oct 8, 2024

@dkd-kaehm Unfortunately, I am not aware of this DI topic. I would prefer the variant with the integration of the Content UID in the settings array. What is your opinion?

Basically, this event listener integration is working.

@dkd-kaehm
Copy link
Collaborator

dkd-kaehm commented Oct 8, 2024

@dkd-kaehm Unfortunately, I am not aware of this DI topic. I would prefer the variant with the integration of the Content UID in the settings array. What is your opinion?

Basically, this event listener integration is working.

Preferred way is to make that class to "Data object"-Type aka non singleton.
To avoid the hacks to reset state. The SettingsPreviewOnPlugins-Object is not necessary anymore after it did its job.

@dkd-kaehm
Copy link
Collaborator

dkd-kaehm commented Oct 8, 2024

@bmack
Is there a way in Services.yaml to mark/define the things as data object?

@bmack
Copy link
Collaborator

bmack commented Oct 8, 2024

"Is there a way to set DI to always deliver new instances?"

Services are shared (= same instance all the time) by default. In "classic" TYPO3-speak this is similar to SingletonInterface as we know from the past, but done in Configuration, not via a Marker interface.

So, to achieve this to always get a new instance, you need to set shared: false in Services.yaml.

@dkd-kaehm
Copy link
Collaborator

@bmack thanks.

So, to achieve this to always get a new instance, you need to set shared: false in Services.yaml.

@ayacoo ;)
Please try it:

# BE modules, plugins 
 ApacheSolrForTypo3\Solr\Backend\SettingsPreviewOnPlugins: 
   arguments: 
     $flexFormService: '@TYPO3\CMS\Core\Service\FlexFormService' 
   tags: 
     - name: event.listener 
       identifier: 'solr.plugin.be.settings.preview' 
       event: TYPO3\CMS\Backend\View\Event\PageContentPreviewRenderingEvent
   shared: false
 # END: BE modules 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants