/** * Add page to section. * * @param Navigation_Abstract $page * @param int $priority * @return $this */ public function add_page(Navigation_Abstract &$page, $priority = 1) { $priority = (int) $priority; // Check permissions if (!ACL::check($page->permissions)) { return $this; } // Priority if (isset($page->priority)) { $priority = (int) $page->priority; } // Typeof if ($page instanceof Navigation_Section) { $this->_sections[] = $page; $page->set_section($this); } else { // Change priority if (isset($this->_pages[$priority])) { while (isset($this->_pages[$priority])) { $priority++; } } // Store page $this->_pages[$priority] = $page; } // Add page buttons if (isset($page->buttons)) { $page->add_buttons($page->buttons); } // $page->set_section($this); return $this->update()->sort(); }
/** * Set active status * * @param bool $status * @return $this */ public function set_active($status = true) { parent::set_active($status); $this->_section->set_active($status); return $this; }