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

Attribute 'name' missing on event course_module_deleted

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.6.4, 3.6.5
    • Fix Version/s: None
    • Component/s: Events API
    • Labels:
    • Affected Branches:
      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

            • Assignee:
              Unassigned
              Reporter:
              christophkarlen christoph karlen
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: