findPublishedSubpagesWithoutGuestsByPid() public static method

Find all published subpages by their parent ID and exclude pages only visible for guests
public static findPublishedSubpagesWithoutGuestsByPid ( integer $intPid, boolean $blnShowHidden = false, boolean $blnIsSitemap = false ) : Collection | PageModel[] | PageModel | null
$intPid integer The parent page's ID
$blnShowHidden boolean If true, hidden pages will be included
$blnIsSitemap boolean If true, the sitemap settings apply
return Contao\Model\Collection | PageModel[] | PageModel | null A collection of models or null if there are no pages
Example #1
0
 /**
  * Recursively get all book pages
  *
  * @param integer $intParentId
  * @param array   $groups
  * @param integer $time
  */
 protected function getBookPages($intParentId, $groups, $time)
 {
     $objPages = \PageModel::findPublishedSubpagesWithoutGuestsByPid($intParentId, $this->showHidden);
     if ($objPages === null) {
         return;
     }
     foreach ($objPages as $objPage) {
         $_groups = \StringUtil::deserialize($objPage->groups);
         // Do not show protected pages unless a back end or front end user is logged in
         if (!$objPage->protected || BE_USER_LOGGED_IN || is_array($_groups) && count(array_intersect($groups, $_groups)) || $this->showProtected) {
             $this->arrPages[$objPage->id] = $objPage;
             if ($objPage->subpages > 0) {
                 $this->getBookPages($objPage->id, $groups, $time);
             }
         }
     }
 }