/** * Add a Page to this PageArray. * * @param Page|PageArray|int $page Page object, PageArray object, or Page ID. * If Page, the Page will be added. * If PageArray, it will do the same thing as the import() function: import all the pages. * If Page ID, it will be loaded and added. * @return PageArray reference to current instance. */ public function add($page) { if ($this->isValidItem($page)) { parent::add($page); $this->numTotal++; } else { if ($page instanceof PageArray || is_array($page)) { return $this->import($page); } else { if (ctype_digit("{$page}")) { if ($page = $this->getFuel('pages')->findOne("id={$page}")) { parent::add($page); $this->numTotal++; } } } } return $this; }