FluidTYPO3\Flux\View\TemplatePaths::extractPathArrays PHP Method

extractPathArrays() protected method

Accepts one or both of the singular and plural path definitions in the input - returns the combined collections of paths based on both the singular and plural entries with the singular entries being recorded first and plurals second. Sorts the passed paths by index in array, in reverse, so that the base View class will iterate the array in the right order when resolving files. Adds legacy singular name as last option, if set.
protected extractPathArrays ( array $paths ) : array
$paths array
return array
    protected function extractPathArrays(array $paths)
    {
        $templateRootPaths = array();
        $layoutRootPaths = array();
        $partialRootPaths = array();
        // Modern plural paths configurations: sorted reverse by key to
        // check the path with the highest number first.
        if (TRUE === isset($paths[self::CONFIG_TEMPLATEROOTPATHS]) && TRUE === is_array($paths[self::CONFIG_TEMPLATEROOTPATHS])) {
            krsort($paths[self::CONFIG_TEMPLATEROOTPATHS], SORT_NUMERIC);
            $templateRootPaths = array_merge($templateRootPaths, array_values($paths[self::CONFIG_TEMPLATEROOTPATHS]));
        }
        if (TRUE === isset($paths[self::CONFIG_LAYOUTROOTPATHS]) && TRUE === is_array($paths[self::CONFIG_LAYOUTROOTPATHS])) {
            krsort($paths[self::CONFIG_LAYOUTROOTPATHS], SORT_NUMERIC);
            $layoutRootPaths = array_merge($layoutRootPaths, array_values($paths[self::CONFIG_LAYOUTROOTPATHS]));
        }
        if (TRUE === isset($paths[self::CONFIG_PARTIALROOTPATHS]) && TRUE === is_array($paths[self::CONFIG_PARTIALROOTPATHS])) {
            krsort($paths[self::CONFIG_PARTIALROOTPATHS], SORT_NUMERIC);
            $partialRootPaths = array_merge($partialRootPaths, array_values($paths[self::CONFIG_PARTIALROOTPATHS]));
        }
        // translate all paths to absolute paths
        $templateRootPaths = array_map(array($this, 'ensureAbsolutePath'), $templateRootPaths);
        $layoutRootPaths = array_map(array($this, 'ensureAbsolutePath'), $layoutRootPaths);
        $partialRootPaths = array_map(array($this, 'ensureAbsolutePath'), $partialRootPaths);
        $templateRootPaths = array_unique($templateRootPaths);
        $partialRootPaths = array_unique($partialRootPaths);
        $layoutRootPaths = array_unique($layoutRootPaths);
        $templateRootPaths = array_values($templateRootPaths);
        $layoutRootPaths = array_values($layoutRootPaths);
        $partialRootPaths = array_values($partialRootPaths);
        $pathCollections = array($templateRootPaths, $layoutRootPaths, $partialRootPaths);
        return $pathCollections;
    }