MDL-32009 messaging: Refator get_settings_url plugintype method

No need to duplicate checks since we have them in one place.
This commit is contained in:
Ruslan Kabalin
2012-04-30 10:34:37 +01:00
parent aa753ac24f
commit bc795b98e9
+7 -5
View File
@@ -2288,12 +2288,14 @@ class plugininfo_enrol extends plugininfo_base {
class plugininfo_message extends plugininfo_base {
public function get_settings_url() {
if (file_exists($this->full_path('settings.php')) or file_exists($this->full_path('settingstree.php'))) {
return new moodle_url('/admin/settings.php', array('section' => 'messagesetting' . $this->name));
} else {
return parent::get_settings_url();
$processors = get_message_processors();
if (isset($processors[$this->name])) {
$processor = $processors[$this->name];
if ($processor->available && $processor->hassettings) {
return new moodle_url('settings.php', array('section' => 'messagesetting'.$processor->name));
}
}
return parent::get_settings_url();
}
}