MDL-80337 availability: more robust checking for plugin class presence.

Co-authored-by: Dustin Brisebois <[email protected]>
This commit is contained in:
Paul Holden
2025-03-16 19:27:29 +00:00
co-authored by Dustin Brisebois
parent b3931cdb95
commit a82df2e07a
3 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -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.