Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-66235

Attribute 'name' missing on event course_module_deleted

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.6.4, 3.6.5
    • None
    • Events API
    • MOODLE_36_STABLE

    Description

      When the event course_module_deleted is triggered the event is missing the 'name' attribute.  

      The event is created here:

      // course/lib.php ~1208
      $event = \core\event\course_module_deleted::create(array(
          'courseid' => $cm->course,
          'context'  => $modcontext,
          'objectid' => $cm->id,
          'other'    => array(
              'modulename' => $modulename,
              'instanceid'   => $cm->instance,
          )
      ));
      

      When you compare it with the implementation in 

      // course/tests/courselib_test.php
      $event = \core\event\course_module_deleted::create(array(
          'courseid' => $modinfo->course,
          'context'  => $context,
          'objectid' => $modinfo->coursemodule,
          'other'    => array(
              'modulename' => 'assign',
              'name'       => 'My assignment',
          )
      ));
      

      Or compared with course_module_updated

      // lib/classes/event/course_module_updated.php ~148
      $event = static::create(array(
          'context'  => $modcontext,
          'objectid' => $cm->id,
          'other'    => array(
              'modulename' => $cm->modname,
              'instanceid' => $cm->instance,
              'name'       => $cm->name,
          )
      ));
      

      I think it would be very useful for many use-cases to have the cm name directly in the event. Additionally it would be consistent with course_module_updated and course_module_created.

       

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            christophkarlen christoph karlen
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: