function navify() { require_once "AMP/Content/Nav.inc.php"; $new_nav = new NavigationElement($this->dbcon); if ($existing_navs = $new_nav->find(array('badge_id' => $this->id))) { $found_nav = current($existing_navs); $flash = AMP_System_Flash::instance(); $flash->add_message($this->getName() . ' already has a nav', get_class($this) . '_navify_message', $found_nav->get_url_edit()); return false; } $new_nav->setDefaults(); $nav_data = array('name' => $this->getName(), 'titletext' => $this->getName(), 'badge_id' => $this->id, 'modid' => AMP_MODULE_ID_CONTENT); $new_nav->mergeData($nav_data); return $new_nav->save(); }