protected function can_add_more_courses_to_category($category) {
        global $CFG;
        $limit = 20;
        if (!empty($CFG->navcourselimit)) {
            $limit = (int)$CFG->navcourselimit;
        }
        if (is_numeric($category)) {
            if (!array_key_exists($category, $this->addedcategories)) {
                return true;
            }
            $coursecount = count($this->addedcategories[$category]->children->type(self::TYPE_COURSE));
        } else if ($category instanceof navigation_node) {
            if (($category->type != self::TYPE_CATEGORY) || ($category->type != self::TYPE_MY_CATEGORY)) {
                return false;
            }
            $coursecount = count($category->children->type(self::TYPE_COURSE));
        } else if (is_object($category) && property_exists($category,'id')) {
            $coursecount = count($this->addedcategories[$category->id]->children->type(self::TYPE_COURSE));
        }
        return ($coursecount <= $limit);
    }
protected function can_add_more_courses_to_category($category) {
        global $CFG;
        $limit = 20;
        if (!empty($CFG->navcourselimit)) {
            $limit = (int)$CFG->navcourselimit;
        }
        if (is_numeric($category)) {
            if (!array_key_exists($category, $this->addedcategories)) {
                return true;
            }
            $coursecount = count($this->addedcategories[$category]->children->type(self::TYPE_COURSE));
        } else if ($category instanceof navigation_node) {
            if (($category->type != self::TYPE_CATEGORY) || ($category->type != self::TYPE_MY_CATEGORY)) {
                return false;
            }
            $coursecount = count($category->children->type(self::TYPE_COURSE));
        } else if (is_object($category) && property_exists($category,'id')) {
            $coursecount = count($this->addedcategories[$category->id]->children->type(self::TYPE_COURSE));
        }
        return ($coursecount <= $limit);
    }
protected function can_add_more_courses_to_category ( $ category ) { global $ CFG ; $ limit = 20 ; if ( ! empty ( $ CFG -> navcourselimit ) ) { $ limit = ( int ) $ CFG -> navcourselimit ; } if ( is_numeric ( $ category ) ) { if ( ! array_key_exists ( $ category , $ this -> addedcategories ) ) { return true ; } $ coursecount = count ( $ this -> addedcategories [ $ category ] -> children -> type ( self :: TYPE_COURSE ) ) ; } else if ( $ category instanceof navigation_node ) { if ( ( $ category -> type != self :: TYPE_CATEGORY ) || ( $ category -> type != self :: TYPE_MY_CATEGORY ) ) { return false ; } $ coursecount = count ( $ category -> children -> type ( self :: TYPE_COURSE ) ) ; } else if ( is_object ( $ category ) && property_exists ( $ category , 'id' ) ) { $ coursecount = count ( $ this -> addedcategories [ $ category -> id ] -> children -> type ( self :: TYPE_COURSE ) ) ; } return ( $ coursecount <= $ limit ) ; }
Returns true if more courses can be added to the provided category.

@param int|navigation_node|stdClass $category
@return bool
Returns true if more courses can be added to the provided category .