public function getAllArticles(): array
    {
        $user     = BackendUser::getInstance();
        $pids     = array();
        $articles = array();

        // Limit pages to the user's pagemounts
        if ($user->isAdmin) {
            $objArticle = Database::getInstance()->execute(
                'SELECT a.id, a.pid, a.title, a.inColumn, p.title AS parent FROM tl_article a
                LEFT JOIN tl_page p ON p.id=a.pid ORDER BY parent, a.sorting'
            );
        } else {
            foreach ($user->pagemounts as $id) {
                $pids[] = $id;
                $pids   = array_merge($pids, Database::getInstance()->getChildRecords($id, 'tl_page'));
            }

            if (empty($pids)) {
                return $articles;
            }

            $pids = implode(',', array_map('intval', array_unique($pids)));

            $objArticle = Database::getInstance()->execute(
                'SELECT a.id, a.pid, a.title, a.inColumn, p.title AS parent
                FROM tl_article a LEFT JOIN tl_page p ON p.id=a.pid WHERE a.pid IN(' . $pids . ')
                ORDER BY parent, a.sorting'
            );
        }

        // Edit the result
        if ($objArticle->numRows) {
            Controller::loadLanguageFile('tl_article');

            while ($objArticle->next()) {
                $key                             = $objArticle->parent . ' (ID ' . $objArticle->pid . ')';
                $articles[$key][$objArticle->id] = $objArticle->title
                    . ' (' . ($GLOBALS['TL_LANG']['tl_article'][$objArticle->inColumn] ?: $objArticle->inColumn)
                    . ', ID ' . $objArticle->id . ')';
            }
        }

        return $articles;
    }
public function getAllArticles(): array
    {
        $user     = BackendUser::getInstance();
        $pids     = array();
        $articles = array();

        // Limit pages to the user's pagemounts
        if ($user->isAdmin) {
            $objArticle = Database::getInstance()->execute(
                'SELECT a.id, a.pid, a.title, a.inColumn, p.title AS parent FROM tl_article a
                LEFT JOIN tl_page p ON p.id=a.pid ORDER BY parent, a.sorting'
            );
        } else {
            foreach ($user->pagemounts as $id) {
                $pids[] = $id;
                $pids   = array_merge($pids, Database::getInstance()->getChildRecords($id, 'tl_page'));
            }

            if (empty($pids)) {
                return $articles;
            }

            $pids = implode(',', array_map('intval', array_unique($pids)));

            $objArticle = Database::getInstance()->execute(
                'SELECT a.id, a.pid, a.title, a.inColumn, p.title AS parent
                FROM tl_article a LEFT JOIN tl_page p ON p.id=a.pid WHERE a.pid IN(' . $pids . ')
                ORDER BY parent, a.sorting'
            );
        }

        // Edit the result
        if ($objArticle->numRows) {
            Controller::loadLanguageFile('tl_article');

            while ($objArticle->next()) {
                $key                             = $objArticle->parent . ' (ID ' . $objArticle->pid . ')';
                $articles[$key][$objArticle->id] = $objArticle->title
                    . ' (' . ($GLOBALS['TL_LANG']['tl_article'][$objArticle->inColumn] ?: $objArticle->inColumn)
                    . ', ID ' . $objArticle->id . ')';
            }
        }

        return $articles;
    }
public function getAllArticles ( ) : array { $ user = BackendUser :: getInstance ( ) ; $ pids = array ( ) ; $ articles = array ( ) ; // Limit pages to the user's pagemounts if ( $ user -> isAdmin ) { $ objArticle = Database :: getInstance ( ) -> execute ( 'SELECT a.id, a.pid, a.title, a.inColumn, p.title AS parent FROM tl_article a
                LEFT JOIN tl_page p ON p.id=a.pid ORDER BY parent, a.sorting' ) ; } else { foreach ( $ user -> pagemounts as $ id ) { $ pids [ ] = $ id ; $ pids = array_merge ( $ pids , Database :: getInstance ( ) -> getChildRecords ( $ id , 'tl_page' ) ) ; } if ( empty ( $ pids ) ) { return $ articles ; } $ pids = implode ( ',' , array_map ( 'intval' , array_unique ( $ pids ) ) ) ; $ objArticle = Database :: getInstance ( ) -> execute ( 'SELECT a.id, a.pid, a.title, a.inColumn, p.title AS parent
                FROM tl_article a LEFT JOIN tl_page p ON p.id=a.pid WHERE a.pid IN(' . $ pids . ')
                ORDER BY parent, a.sorting' ) ; } // Edit the result if ( $ objArticle -> numRows ) { Controller :: loadLanguageFile ( 'tl_article' ) ; while ( $ objArticle -> next ( ) ) { $ key = $ objArticle -> parent . ' (ID ' . $ objArticle -> pid . ')' ; $ articles [ $ key ] [ $ objArticle -> id ] = $ objArticle -> title . ' (' . ( $ GLOBALS [ 'TL_LANG' ] [ 'tl_article' ] [ $ objArticle -> inColumn ] ? : $ objArticle -> inColumn ) . ', ID ' . $ objArticle -> id . ')' ; } } return $ articles ; }
Get all articles and return them as array.

@return array

@SuppressWarnings(PHPMD.Superglobals)
Get all articles and return them as array .