Permalink
Browse files

MDL-32009 messaging: Refator get_settings_url plugintype method

No need to duplicate checks since we have them in one place.
  • Loading branch information...
1 parent aa753ac commit bc795b98e96743fa29654abbaa4f17a681303987 Ruslan Kabalin committed Mar 9, 2012
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/pluginlib.php
View
@@ -2288,12 +2288,14 @@ public function get_uninstall_url() {
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();
}
}

0 comments on commit bc795b9

Please sign in to comment.