Bug #79061
closedBug in extbase with TemplatesRootPaths in backend
0%
Description
Hi,
I found a problem in PHP the extbase configuration array['view']['TemplatesRootPaths'] wasn't sorted and i have the following debug when i use the ConfigurationManagerInterface:
array['view']['TemplatesRootPaths'] = array ( 1 => 'my overwrite', 0 => 'base template' )
But we need to have :
array['view']['TemplatesRootPaths'] = array ( 0 => 'base template', 1 => 'my overwrite' )
This problems comes when we use ext_typoscript_setup.txt in our extension, when we try to use the surcharge, we see that the array isn’t sorted. Then TYPO3 take the last template he found in the array. And in some cases, thats not the right
In TYPO3 source we need to sort all typoscript code in typo3/sysext/extbase/Classes/Service/TypoScriptService.php :
Because it look like the TYPO3 backend typoscript service take the last item in the configuration array and don’t care about the numbers (0,1,2…).
public function convertTypoScriptArrayToPlainArray(array $typoScriptArray) { foreach ($typoScriptArray as $key => $value) { if (substr($key, -1) === '.') { $keyWithoutDot = substr($key, 0, -1); $typoScriptNodeValue = isset($typoScriptArray[$keyWithoutDot]) ? $typoScriptArray[$keyWithoutDot] : null; if (is_array($value)) { ksort($value); $typoScriptArray[$keyWithoutDot] = $this->convertTypoScriptArrayToPlainArray($value); if (!is_null($typoScriptNodeValue)) { ksort($typoScriptNodeValue); $typoScriptArray[$keyWithoutDot]['_typoScriptNodeValue'] = $typoScriptNodeValue; } unset($typoScriptArray[$key]); } else { $typoScriptArray[$keyWithoutDot] = null; } } } return $typoScriptArray; }
I added two ksort.
What do you think about it ?
Updated by Mathias Brodala over 7 years ago
- Status changed from New to Resolved
This was fixed with #75862.
Updated by Mathias Brodala over 7 years ago
- Category changed from Extbase to Fluid
- Status changed from Resolved to New
Updated by Claus Due about 7 years ago
@Mathias did you accidentally set status "New" when you moved this to the Fluid category? As far as I know, https://forge.typo3.org/projects/typo3cms-core/repository/revisions/eadb165d401e53a533e3922cf45769a8c427ffc1/diff/typo3/sysext/fluid/Classes/View/TemplatePaths.php should have solved this one!
Updated by Claus Due about 7 years ago
NB: the name of the setting is `templateRootPaths`, not `TemplatesRootPaths` (I suspect this may be auto-correct from your editor plus a typo, just wanted to make it perfectly clear: if you defined them this way you should expect your paths to be completely ignored).
Updated by Mathias Brodala about 7 years ago
- Status changed from New to Resolved
Closing again just like before. ;-)