protected function filterDuplicateConnections(array $connections)
    {
        $hashedConnections = [];
        $filteredConnections = [];

        // array_unique() doesn't work on multi dimensional arrays, so we need to flatten it first
        foreach ($connections as $key => $connection) {
            unset($connection['language']);
            $connectionHash = md5(implode('|', $connection));
            $hashedConnections[$key] = $connectionHash;
        }

        $hashedConnections = array_unique($hashedConnections);

        foreach ($hashedConnections as $key => $hash) {
            $filteredConnections[$key] = $connections[$key];
        }

        return $filteredConnections;
    }
protected function filterDuplicateConnections(array $connections)
    {
        $hashedConnections = [];
        $filteredConnections = [];

        // array_unique() doesn't work on multi dimensional arrays, so we need to flatten it first
        foreach ($connections as $key => $connection) {
            unset($connection['language']);
            $connectionHash = md5(implode('|', $connection));
            $hashedConnections[$key] = $connectionHash;
        }

        $hashedConnections = array_unique($hashedConnections);

        foreach ($hashedConnections as $key => $hash) {
            $filteredConnections[$key] = $connections[$key];
        }

        return $filteredConnections;
    }
protected function filterDuplicateConnections ( array $ connections ) { $ hashedConnections = [ ] ; $ filteredConnections = [ ] ; // array_unique() doesn't work on multi dimensional arrays, so we need to flatten it first foreach ( $ connections as $ key => $ connection ) { unset ( $ connection [ 'language' ] ) ; $ connectionHash = md5 ( implode ( '|' , $ connection ) ) ; $ hashedConnections [ $ key ] = $ connectionHash ; } $ hashedConnections = array_unique ( $ hashedConnections ) ; foreach ( $ hashedConnections as $ key => $ hash ) { $ filteredConnections [ $ key ] = $ connections [ $ key ] ; } return $ filteredConnections ; }
Filters duplicate connections. When detecting the configured connections
this is done with a little brute force by simply combining all root pages
with all languages, this method filters out the duplicates.

@param array $connections An array of unfiltered connections, containing duplicates
@return array An array with connections, no duplicates.
Filters duplicate connections . When detecting the configured connections this is done with a little brute force by simply combining all root pages with all languages this method filters out the duplicates .