Merge branch 'MDL-80337' of https://github.com/paulholden/moodle
This commit is contained in:
@@ -117,6 +117,11 @@ abstract class frontend {
|
||||
foreach ($enabled as $plugin => $info) {
|
||||
// Create plugin front-end object.
|
||||
$class = '\availability_' . $plugin . '\frontend';
|
||||
if (!class_exists($class)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var \core_availability\frontend $frontend */
|
||||
$frontend = new $class();
|
||||
|
||||
// Add to array of required YUI modules.
|
||||
|
||||
@@ -792,11 +792,10 @@ abstract class info {
|
||||
// plugin could also rely on the completion plugin.
|
||||
$pluginmanager = \core_plugin_manager::instance();
|
||||
$enabled = $pluginmanager->get_enabled_plugins('availability');
|
||||
$componentparams = new \stdClass();
|
||||
foreach ($enabled as $plugin => $info) {
|
||||
// Use the static method.
|
||||
/** @var \core_availability\condition $class */
|
||||
$class = '\availability_' . $plugin . '\condition';
|
||||
if ($class::completion_value_used($course, $cmid)) {
|
||||
if (class_exists($class) && $class::completion_value_used($course, $cmid)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,9 +220,9 @@ class tree extends tree_node {
|
||||
|
||||
// First see if it's a condition. These have a defined type.
|
||||
if (isset($child->type)) {
|
||||
// Look for a plugin of this type.
|
||||
/** @var \core_availability\condition $classname */
|
||||
$classname = '\availability_' . $child->type . '\condition';
|
||||
if (!array_key_exists($child->type, $enabled)) {
|
||||
if (!array_key_exists($child->type, $enabled) || !class_exists($classname)) {
|
||||
if ($lax) {
|
||||
// On load of existing settings, ignore if class
|
||||
// doesn't exist.
|
||||
|
||||
Reference in New Issue
Block a user