MDL-35661 Loading of plugin settings for enrol plugins (plugininfo_enrol)
This commit is contained in:
+17
-5
@@ -2445,12 +2445,24 @@ class plugininfo_enrol extends plugininfo_base {
|
||||
return isset($enabled[$this->name]);
|
||||
}
|
||||
|
||||
public function get_settings_url() {
|
||||
public function get_settings_section_name() {
|
||||
return 'enrolsettings' . $this->name;
|
||||
}
|
||||
|
||||
if ($this->is_enabled() or file_exists($this->full_path('settings.php'))) {
|
||||
return new moodle_url('/admin/settings.php', array('section' => 'enrolsettings' . $this->name));
|
||||
} else {
|
||||
return parent::get_settings_url();
|
||||
public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
|
||||
global $CFG, $USER, $DB, $OUTPUT, $PAGE; // in case settings.php wants to refer to them
|
||||
$ADMIN = $adminroot; // may be used in settings.php
|
||||
$enrol = $this; // also can be used inside settings.php
|
||||
$section = $this->get_settings_section_name();
|
||||
|
||||
$settings = null;
|
||||
if ($hassiteconfig && file_exists($this->full_path('settings.php'))) {
|
||||
$settings = new admin_settingpage($section, $this->displayname,
|
||||
'moodle/site:config', $this->is_enabled() === false);
|
||||
include($this->full_path('settings.php')); // this may also set $settings to null
|
||||
}
|
||||
if ($settings) {
|
||||
$ADMIN->add($parentnodename, $settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user