Project

General

Profile

Actions

Bug #79061

closed

Bug in extbase with TemplatesRootPaths in backend

Added by layen julian over 7 years ago. Updated over 5 years ago.

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 ?


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #75862: fluid_styled_content: fallback for template paths doesn't workClosed2016-04-22

Actions
Actions #1

Updated by Mathias Brodala over 7 years ago

  • Status changed from New to Resolved

This was fixed with #75862.

Actions #2

Updated by Mathias Brodala over 7 years ago

  • Category changed from Extbase to Fluid
  • Status changed from Resolved to New
Actions #3

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!

Actions #4

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).

Actions #5

Updated by Mathias Brodala about 7 years ago

  • Status changed from New to Resolved

Closing again just like before. ;-)

Actions #6

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF