Commit 27b29b29 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

MDL-67548 core_course: Reflect content move category in deleted event.

parent 39e777e3
......@@ -2169,7 +2169,7 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
$event = \core\event\course_category_deleted::create(array(
'objectid' => $this->id,
'context' => $context,
'other' => array('name' => $this->name)
'other' => array('name' => $this->name, 'contentmovedcategoryid' => $newparentid)
));
$event->set_coursecat($this);
$event->trigger();
......
......@@ -33,6 +33,7 @@ defined('MOODLE_INTERNAL') || die();
* Extra information about event.
*
* - string name: category name.
* - string contentmovedcategoryid: (optional) category id where content was moved on deletion
* }
*
* @package core
......@@ -71,7 +72,11 @@ class course_category_deleted extends base {
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' deleted the course category with id '$this->objectid'.";
$descr = "The user with id '$this->userid' deleted the course category with id '$this->objectid'.";
if (!empty($this->other['contentmovedcategoryid'])) {
$descr .= " Its content has been moved to category with id '{$this->other['contentmovedcategoryid']}'.";
}
return $descr;
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment