• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed  return missing in Language Model

R

ragtek

Guest
#1
method _getAllChildLanguageIds doesn't return anything, if the language have child ids

It's not used anywhere (The method is used in getAllChildLanguageIds which isn't called in xf) but i wanted to use it for my add-on

PHP:
    protected function _getAllChildLanguageIds($parentId, array $languageTree)
    {
        if (!isset($languageTree[$parentId]))
        {
            return array();
        }

        $children = array();
        foreach ($languageTree[$parentId] AS $childId)
        {
            $children[] = $childId;
            $children = array_merge($children, $this->_getAllChildLanguageIds($childId, $languageTree));
        }
    }
should be
PHP:
    protected function _getAllChildLanguageIds($parentId, array $languageTree)
    {
        if (!isset($languageTree[$parentId]))
        {
            return array();
        }

        $children = array();
        foreach ($languageTree[$parentId] AS $childId)
        {
            $children[] = $childId;
            $children = array_merge($children, $this->_getAllChildLanguageIds($childId, $languageTree));
        }
        return $children;
    }
 

Attachments