protected function insertCMSNavItem(CMSNavItem $cms_nav_item, Plugin $plugin)
    {
        $cms_nav_item->PluginID = $plugin->PluginID;

//        if($cms_nav_item->Slug == '')
//            $cms_nav_item->Slug = SlugUtils::createSlug($cms_nav_item->Label);
//
//        if (empty($cms_nav_item->SortOrder))
//            $cms_nav_item->SortOrder = PHP_INT_MAX;

        $cms_nav_item->ModifiedDate = $plugin->ModifiedDate;

        try {

            if (!$this->CMSNavItemService->slugExists($cms_nav_item->Slug)) {
                $this->CMSNavItemService->add($cms_nav_item);
                return true;
            } else {
                $existing_nav_item = $this->CMSNavItemService->getBySlug($cms_nav_item->Slug);
                if($existing_nav_item->PluginID == $cms_nav_item->PluginID)
                {
                    $cms_nav_item->CMSNavItemID = $existing_nav_item->CMSNavItemID;
                    $this->CMSNavItemService->edit($cms_nav_item);
                }
            }

        } catch(ValidationException $ve) {
            throw new Exception('CMSNavItem ['.$cms_nav_item->Slug.']: '.$ve->getMessage());
        }
        return false;
    }
protected function insertCMSNavItem(CMSNavItem $cms_nav_item, Plugin $plugin)
    {
        $cms_nav_item->PluginID = $plugin->PluginID;

//        if($cms_nav_item->Slug == '')
//            $cms_nav_item->Slug = SlugUtils::createSlug($cms_nav_item->Label);
//
//        if (empty($cms_nav_item->SortOrder))
//            $cms_nav_item->SortOrder = PHP_INT_MAX;

        $cms_nav_item->ModifiedDate = $plugin->ModifiedDate;

        try {

            if (!$this->CMSNavItemService->slugExists($cms_nav_item->Slug)) {
                $this->CMSNavItemService->add($cms_nav_item);
                return true;
            } else {
                $existing_nav_item = $this->CMSNavItemService->getBySlug($cms_nav_item->Slug);
                if($existing_nav_item->PluginID == $cms_nav_item->PluginID)
                {
                    $cms_nav_item->CMSNavItemID = $existing_nav_item->CMSNavItemID;
                    $this->CMSNavItemService->edit($cms_nav_item);
                }
            }

        } catch(ValidationException $ve) {
            throw new Exception('CMSNavItem ['.$cms_nav_item->Slug.']: '.$ve->getMessage());
        }
        return false;
    }
protected function insertCMSNavItem ( CMSNavItem $ cms_nav_item , Plugin $ plugin ) { $ cms_nav_item -> PluginID = $ plugin -> PluginID ; //        if($cms_nav_item->Slug == '') //            $cms_nav_item->Slug = SlugUtils::createSlug($cms_nav_item->Label); // //        if (empty($cms_nav_item->SortOrder)) //            $cms_nav_item->SortOrder = PHP_INT_MAX; $ cms_nav_item -> ModifiedDate = $ plugin -> ModifiedDate ; try { if ( ! $ this -> CMSNavItemService -> slugExists ( $ cms_nav_item -> Slug ) ) { $ this -> CMSNavItemService -> add ( $ cms_nav_item ) ; return true ; } else { $ existing_nav_item = $ this -> CMSNavItemService -> getBySlug ( $ cms_nav_item -> Slug ) ; if ( $ existing_nav_item -> PluginID == $ cms_nav_item -> PluginID ) { $ cms_nav_item -> CMSNavItemID = $ existing_nav_item -> CMSNavItemID ; $ this -> CMSNavItemService -> edit ( $ cms_nav_item ) ; } } } catch ( ValidationException $ ve ) { throw new Exception ( 'CMSNavItem [' . $ cms_nav_item -> Slug . ']: ' . $ ve -> getMessage ( ) ) ; } return false ; }
Inserts the specified CMS Nav Item

@param CMSNavItem $cms_nav_item The item to insert
@param Plugin     $plugin       The plugin that owns the nav item

@return boolean true on success
Inserts the specified CMS Nav Item