original_string: public static final function create_from_cm($cm, $modcontext = null) {
          // If not set, get the module context.
          if (empty($modcontext)) {
              $modcontext = \context_module::instance($cm->id);
          }
  
          // Create event object for course module update action.
          $event = static::create(array(
              'context'  => $modcontext,
              'objectid' => $cm->id,
              'other'    => array(
                  'modulename' => $cm->modname,
                  'instanceid' => $cm->instance,
                  'name'       => $cm->name,
              )
          ));
          return $event;
      }
code: public static final function create_from_cm($cm, $modcontext = null) {
          // If not set, get the module context.
          if (empty($modcontext)) {
              $modcontext = \context_module::instance($cm->id);
          }
  
          // Create event object for course module update action.
          $event = static::create(array(
              'context'  => $modcontext,
              'objectid' => $cm->id,
              'other'    => array(
                  'modulename' => $cm->modname,
                  'instanceid' => $cm->instance,
                  'name'       => $cm->name,
              )
          ));
          return $event;
      }
code_tokens: public static final function create_from_cm ( $ cm , $ modcontext = null ) { // If not set, get the module context. if ( empty ( $ modcontext ) ) { $ modcontext = \ context_module :: instance ( $ cm -> id ) ; } // Create event object for course module update action. $ event = static :: create ( array ( 'context' => $ modcontext , 'objectid' => $ cm -> id , 'other' => array ( 'modulename' => $ cm -> modname , 'instanceid' => $ cm -> instance , 'name' => $ cm -> name , ) ) ) ; return $ event ; }
docstring: Set data to create new event from course module.
  
  @param \cm_info|\stdClass $cm course module instance, as returned by {@link get_coursemodule_from_id}
  or {@link get_coursemodule_from_instance}.
  @param \context_module $modcontext module context instance
  @return \core\event\base returns instance of new event
docstring_tokens: Set data to create new event from course module .