public static function update($itemid, $newvalue) {
        $context = context_module::instance($itemid);
        // Check access.
        \external_api::validate_context($context);
        require_capability('moodle/course:manageactivities', $context);
        // Update value.
        set_coursemodule_name($itemid, $newvalue);
        $coursemodulerecord = get_coursemodule_from_id('', $itemid, 0, false, MUST_EXIST);
        // Return instance.
        $cm = get_fast_modinfo($coursemodulerecord->course)->get_cm($itemid);
        return new static($cm, true);
    }
public static function update($itemid, $newvalue) {
        $context = context_module::instance($itemid);
        // Check access.
        \external_api::validate_context($context);
        require_capability('moodle/course:manageactivities', $context);
        // Update value.
        set_coursemodule_name($itemid, $newvalue);
        $coursemodulerecord = get_coursemodule_from_id('', $itemid, 0, false, MUST_EXIST);
        // Return instance.
        $cm = get_fast_modinfo($coursemodulerecord->course)->get_cm($itemid);
        return new static($cm, true);
    }
public static function update ( $ itemid , $ newvalue ) { $ context = context_module :: instance ( $ itemid ) ; // Check access. \ external_api :: validate_context ( $ context ) ; require_capability ( 'moodle/course:manageactivities' , $ context ) ; // Update value. set_coursemodule_name ( $ itemid , $ newvalue ) ; $ coursemodulerecord = get_coursemodule_from_id ( '' , $ itemid , 0 , false , MUST_EXIST ) ; // Return instance. $ cm = get_fast_modinfo ( $ coursemodulerecord -> course ) -> get_cm ( $ itemid ) ; return new static ( $ cm , true ) ; }
Updates course module name

@param int $itemid course module id
@param string $newvalue new name
@return static
Updates course module name