mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 20:53:53 +01:00
MDL-35661 Loading of plugin settings for repositories plugins (plugininfo_repository)
This commit is contained in:
parent
eb30df1e5f
commit
c517dd68f7
@ -239,17 +239,8 @@ if ($hassiteconfig) {
|
||||
$ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit',
|
||||
new lang_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true),
|
||||
'', $url);
|
||||
foreach (repository::get_types() as $repositorytype) {
|
||||
//display setup page for plugins with: general options or multiple instances (e.g. has instance config)
|
||||
$typeoptionnames = repository::static_function($repositorytype->get_typename(), 'get_type_option_names');
|
||||
$instanceoptionnames = repository::static_function($repositorytype->get_typename(), 'get_instance_option_names');
|
||||
if (!empty($typeoptionnames) || !empty($instanceoptionnames)) {
|
||||
|
||||
$params = array('action'=>'edit', 'sesskey'=>sesskey(), 'repos'=>$repositorytype->get_typename());
|
||||
$settingsurl = new moodle_url("/$CFG->admin/repository.php", $params);
|
||||
$repositoryexternalpage = new admin_externalpage('repositorysettings'.$repositorytype->get_typename(), $repositorytype->get_readablename(), $settingsurl);
|
||||
$ADMIN->add('repositorysettings', $repositoryexternalpage);
|
||||
}
|
||||
foreach ($allplugins['repository'] as $repositorytype) {
|
||||
$repositorytype->load_settings($ADMIN, 'repositorysettings', $hassiteconfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2575,12 +2575,19 @@ class plugininfo_repository extends plugininfo_base {
|
||||
return isset($enabled[$this->name]);
|
||||
}
|
||||
|
||||
public function get_settings_url() {
|
||||
public function get_settings_section_name() {
|
||||
return 'repositorysettings'.$this->name;
|
||||
}
|
||||
|
||||
if ($this->is_enabled()) {
|
||||
return new moodle_url('/admin/repository.php', array('sesskey' => sesskey(), 'action' => 'edit', 'repos' => $this->name));
|
||||
} else {
|
||||
return parent::get_settings_url();
|
||||
public function load_settings(part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig) {
|
||||
if ($hassiteconfig && $this->is_enabled()) {
|
||||
// completely no access to repository setting when it is not enabled
|
||||
$sectionname = $this->get_settings_section_name();
|
||||
$settingsurl = new moodle_url('/admin/repository.php',
|
||||
array('sesskey' => sesskey(), 'action' => 'edit', 'repos' => $this->name));
|
||||
$settings = new admin_externalpage($sectionname, $this->displayname,
|
||||
$settingsurl, 'moodle/site:config', false);
|
||||
$adminroot->add($parentnodename, $settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user