mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Added feature to blocks (and restorelib) so that blocks get a method call (default does nothing) after they are restored. This allows blocks to change their settings if necessary in respect of the new course roll-forward 'restore and change start date' feature that Al implemented recently. The core blocks happen not to store dates anyway so don't need this, but contributed blocks may well do.
This commit is contained in:
parent
db33348f53
commit
a82e9bc3bb
@ -797,6 +797,11 @@
|
||||
$status = false;
|
||||
break;
|
||||
}
|
||||
|
||||
//Get an object for the block and tell it it's been restored so it can update dates
|
||||
//etc. if necessary
|
||||
$blockobj=block_instance($instance->name,$instance);
|
||||
$blockobj->after_restore($restore);
|
||||
|
||||
//Now we can increment the weight counter
|
||||
++$maxweights[$instance->position];
|
||||
@ -5461,4 +5466,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
@ -122,6 +122,14 @@ class block_base {
|
||||
*/
|
||||
function before_delete() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that can be overridden to do extra setup after a block instance has been
|
||||
* restored from backup. For example, it may need to alter any dates that the block
|
||||
* stores, if the $restore->course_startdateoffset is set.
|
||||
*/
|
||||
function after_restore($restore) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the block name, as present in the class name,
|
||||
@ -708,4 +716,4 @@ class block_list extends block_base {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user