Skip to content

Commit

Permalink
MDL-32009 messaging: Refator get_settings_url plugintype method
Browse files Browse the repository at this point in the history
No need to duplicate checks since we have them in one place.
  • Loading branch information
Ruslan Kabalin committed Apr 30, 2012
1 parent aa753ac commit bc795b9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/pluginlib.php
Expand Up @@ -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();
}
}

Expand Down

0 comments on commit bc795b9

Please sign in to comment.