#88572ConfigurationManager returns wrong configuration
Description
My (simplified) page tree looks something like this:
[0]
├─[1] Root Page Site A
│ ├─[2] Page 1
│ └─[3] Root Page Site B
│
└─[4] Root Page Site C
└─[5] MyExt Plugin
This is the configuration for these pages:
[1] Root TS template, site configuration
3 Root TS template (clear setup + constants NOT set), site configuration
4 Root TS template (includes static template for MyExt), site configuration
5 Plugin flexform has an itemsProcFunc which requires a TS setting
In the itemsProcFunc I try to read the TS for MyExt like this:
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$configurationManager = $objectManager->get(ConfigurationManager::class);
$tsConf = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
But this didn’t give me the TS for MyExt. However, when I added the static template to [1], I did get the TS for MyExt.
I then debugged $configurationManager and noticed the following, when opening the plugin flexform:
concreteConfigurationManager => TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager
currentPageId => 3 (integer)
The currentPageId doesn’t make any sense. But at least it explains, why I’d get the TS for MyExt after adding the static template to page uid [1]…
The Extbase controller of the plugin on [5] gets the correct TS settings. In the TS object browser I get the correct TS configuration when standing on [5]. It’s only in the itemsProcFunc, where things seem to go wrong.
I have used this kind of function many times before (T3 < V9) without any problems, but never with site configurations.
Reviews 1
Related issues 5
- Task #54813BackendConfigurationManager figures out wrong pid
- Feature #90429ConfigurationManager should offer a way to define the site it is fetching a configuration for
- Bug #93251getCurrentPageId not working correctly in multisite systems
- Bug #102380Resolve correct page UID in BackendConfigurationManager
- Task #105728Stop guessing pid in extbase BackendConfigurationManager