Contao\Controller::eliminateNestedPages PHP Method

eliminateNestedPages() protected method

Take an array of pages and eliminate the nested ones
protected eliminateNestedPages ( array $arrPages, string $strTable = null, boolean $blnSorting = false ) : array
$arrPages array The array of page IDs
$strTable string The table name
$blnSorting boolean True if the table has a sorting field
return array The page IDs array without the nested IDs
    protected function eliminateNestedPages($arrPages, $strTable = null, $blnSorting = false)
    {
        if (!is_array($arrPages) || empty($arrPages)) {
            return array();
        }
        if (!$strTable) {
            $strTable = 'tl_page';
        }
        // Thanks to Andreas Schempp (see #2475 and #3423)
        $arrPages = array_intersect($this->Database->getChildRecords(0, $strTable, $blnSorting), $arrPages);
        $arrPages = array_values(array_diff($arrPages, $this->Database->getChildRecords($arrPages, $strTable, $blnSorting)));
        return $arrPages;
    }