Example #1
0
 /** Returns the cID for the page. If $page is an alias it returns the cID of the original page.
  * @param Page $page The Page instance for which you want the original Page.
  * @param int $aliasLevel [out] Will be set to: 0 if $page is not an alias, 1 if $page is an alias (but not the current page), 2 if $page is an alias and it's the current page.
  * @return int Returns the cID of the original page.
  */
 private static function getOriginal_cID($page, &$aliasLevel = null)
 {
     $cID = (int) $page->cID;
     if ($page->isAlias()) {
         $aliasOf = (int) $page->getCollectionPointerID();
         if ($aliasOf != $cID) {
             $aliasLevel = 1;
             return $aliasOf;
         } else {
             // This happens if $page is an alias and it's the current page.
             $aliasLevel = 2;
         }
     } else {
         $aliasLevel = 0;
     }
     return $cID;
 }