Actions
Bug #79061
closedBug in extbase with TemplatesRootPaths in backend
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2016-12-21
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:
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 ?
Actions