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

Reading frontend typoscript settings with BackendConfigurationManager in LanguageRedirectMiddleware #54

Open
bigahuna opened this issue Apr 29, 2024 · 0 comments · May be fixed by #56
Open

Comments

@bigahuna
Copy link

bigahuna commented Apr 29, 2024

Describe the bug

  • TYPO3 v12.4.14
  • php 8.2
  • locate

Leuchtfeuer\Locate\Middleware\LanguageRedirectMiddleware reads typoscript settings like this
$typoScript = $this->backendConfigurationManager->getTypoScriptSetup();

Reading typoscript frontend settings with the backendConfigurationManager results in unexpected behaviour with typoscript like this:

[traverse(page, "uid") in [968,967,202,965,969]]
    config.tx_locate = 0
[ELSE]
    config.tx_locate = 1
[GLOBAL]

The condition
if (isset($typoScript['config.']['tx_locate']) && (int)$typoScript['config.']['tx_locate'] === 1) {}
in LanguageRedirectMiddleware always returns true (config.tx_locate will always be 1), no matter what typoscript settings are configured. Maybe the reson is a changed behaviour in BackendConfigurationManager for TYPO3 v12. I did not dig deeper into this because there is a better, working solution:

If the typoscript setting will be read with the normal ConfigurationManager like this, it works just fine again:

/** @var ConfigurationManager $configurationManager */
$configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
$typoScript = $configurationManager->getConfiguration(
ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT,
    'sitepackage'
);

As far as I see, the BackendConfigurationManager is not really supposed to read frontend typoscript code anyway. See comment at the start of the class:

/*
* Load TypoScript of a page in backend mode.
*
* Extbase Backend modules can be configured with Frontend TypoScript. This is of course a very
* bad thing, but it is how it is ^^ (we'll get rid of this at some point, promised!)
*/

To Reproduce
Steps to reproduce the behavior:
Try to read fronten typoscript settings with the BackendConfigurationManager in Leuchtfeuer\Locate\Middleware\LanguageRedirectMiddleware

I hope I did not miss anything an will create a pull request.

Regards and thanks for a great and usefull extension!!
Mike

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