mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-44403 events: added public method to get eventdata
This commit is contained in:
parent
76e4de31cc
commit
24c32bdf2f
10 changed files with 85 additions and 73 deletions
|
@ -37,7 +37,7 @@ defined('MOODLE_INTERNAL') || die();
|
|||
class blog_entry_deleted extends \core\event\base {
|
||||
|
||||
/** @var \blog_entry A reference to the active blog_entry object. */
|
||||
protected $customobject;
|
||||
protected $blogentry;
|
||||
|
||||
/**
|
||||
* Set basic event properties.
|
||||
|
@ -59,12 +59,24 @@ class blog_entry_deleted extends \core\event\base {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set custom data of the event.
|
||||
* Sets blog_entry object to be used by observers.
|
||||
*
|
||||
* @param \blog_entry $data A reference to the active blog_entry object.
|
||||
*/
|
||||
public function set_custom_data(\blog_entry $data) {
|
||||
$this->customobject = $data;
|
||||
public function set_blog_entry(\blog_entry $blogentry) {
|
||||
$this->blogentry = $blogentry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns deleted blog entry for event observers.
|
||||
*
|
||||
* @return \blog_entry
|
||||
*/
|
||||
public function get_blog_entry() {
|
||||
if ($this->is_restored()) {
|
||||
throw new \coding_exception('Function get_blog_entry() can not be used on restored events.');
|
||||
}
|
||||
return $this->blogentry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +103,7 @@ class blog_entry_deleted extends \core\event\base {
|
|||
* @return \blog_entry
|
||||
*/
|
||||
protected function get_legacy_eventdata() {
|
||||
return $this->customobject;
|
||||
return $this->blogentry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue