Bug in PageList with multilingual pages (8.1)


I wondered why my pagelist block didn't show any results in other languages except the default one. I found in PageList.php

$query->setParameter('siteTreeID', $tree->getSiteTreeID());

This always sets the search to the default siteTreeId, as getSiteTreeID() uses getSiteTreeObject() that is defined as

$locale = $this->getDefaultLocale();
        if (is_object($locale)) {
            return $locale->getSiteTree();

So this always uses the default locale. This seems to be wrong for multilingual pages, as there are different site trees for different languages.

This is a severe bug, as it prevents multilingual pages from working properly. Currently I have not found an easy way to solve it. For now I did a hack that just removes the siteTreeId from PageList if it is not set:

if (is_object($this->siteTree)) {
            $tree = $this->siteTree;
        } else {
            //$site = \Core::make("site")->getSite();
            //$tree = $site->getSiteTreeObject();
            $tree = null;
        // Note, we might not use this. We have to set the parameter even if we don't use it because
        // StackList (which extends PageList) needs to have it available.
        if ($tree) $query->setParameter('siteTreeID', $tree->getSiteTreeID());
        if ($this->query->getParameter('cParentID') < 1) {
            if (!$this->includeSystemPages) {
                if ($tree) $query->andWhere('p.siteTreeID = :siteTreeID');
                $query->andWhere('p.cIsSystemPage = :cIsSystemPage');
                $query->setParameter('cIsSystemPage', false);

But I do not know if this causes errors in other places?

View Replies:
andrew replied on at Permalink Reply
This is fixed and will be released in 8.2.
Guido replied on at Permalink Reply
Hi Andrew, is there a launch date for 8.2?