MDL-72339 core_availability: Unsafe to use format_string in description
The availability condition get_description method is called while gathering data for the modinfo object. As such it is not safe to call other functions which might rely on modinfo, such as format_string (if using filters which access modinfo). This change provides a mechanism to call format_string later, and also a general callback to do other stuff later as well if needed. It uses the same approach already taken to make activity names work correctly in the availability_condition class.
This commit is contained in:
@@ -51,7 +51,7 @@ class info_module extends info {
|
||||
// We cannot access $cm->name as a property at this point, because this
|
||||
// code may itself run in response to the $cm->name property access, and
|
||||
// PHP magic function properties do not allow recursion (because PHP).
|
||||
return '<AVAILABILITY_CMNAME_' . $this->cm->id . '/>';
|
||||
return condition::description_cm_name($this->cm->id);
|
||||
}
|
||||
|
||||
protected function set_in_database($availability) {
|
||||
|
||||
Reference in New Issue
Block a user