MDL-82541 core_courseformat: delegated sections in disabled plugins

This commit is contained in:
ferranrecio
2024-09-12 16:07:42 +02:00
parent 3477082aa9
commit ebaf06848c
8 changed files with 257 additions and 15 deletions
+15 -1
View File
@@ -59,7 +59,11 @@ abstract class sectiondelegate {
if ($classname === null) {
return null;
}
return new $classname($sectioninfo);
$instance = new $classname($sectioninfo);
if (!$instance->is_enabled()) {
return null;
}
return $instance;
}
/**
@@ -84,6 +88,16 @@ abstract class sectiondelegate {
return self::get_delegate_class_name($pluginname) !== null;
}
/**
* Check if the delegate is enabled.
*
* Usually this happens when the delegate plugin is disabled.
* @return bool
*/
public function is_enabled(): bool {
return true;
}
/**
* Define the section final name.
*