MDL-43736 Events: event->contextinstanceid should be used where possible
While restoring event context might not be present (deleted) So before using context api's check context or use event properties
This commit is contained in:
@@ -79,7 +79,12 @@ abstract class comment_created extends \core\event\base {
|
||||
* @return \moodle_url
|
||||
*/
|
||||
public function get_url() {
|
||||
return $this->context->get_url();
|
||||
$context = $this->get_context();
|
||||
if ($context) {
|
||||
return $context->get_url();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user