mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-72125 testing: Make global $CFG available when including generators
This will remove the requirement to add the global $CFG call to the top of generator scripts.
This commit is contained in:
parent
753035e090
commit
1a885a1756
1 changed files with 3 additions and 0 deletions
|
@ -103,6 +103,9 @@ EOD;
|
||||||
* @return component_generator_base or rather an instance of the appropriate subclass.
|
* @return component_generator_base or rather an instance of the appropriate subclass.
|
||||||
*/
|
*/
|
||||||
public function get_plugin_generator($component) {
|
public function get_plugin_generator($component) {
|
||||||
|
// Note: This global is included so that generator have access to it.
|
||||||
|
// CFG is widely used in require statements.
|
||||||
|
global $CFG;
|
||||||
list($type, $plugin) = core_component::normalize_component($component);
|
list($type, $plugin) = core_component::normalize_component($component);
|
||||||
$cleancomponent = $type . '_' . $plugin;
|
$cleancomponent = $type . '_' . $plugin;
|
||||||
if ($cleancomponent != $component) {
|
if ($cleancomponent != $component) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue