Refactoring the configuration file code

This commit is contained in:
Valentin Popov 2017-10-26 17:11:34 +04:00
parent 8ed2352fbe
commit 6b5c96a383

View File

@ -26,20 +26,14 @@ defined("MOODLE_INTERNAL") || die();
$settings = null; $settings = null;
if ($hassiteconfig) { if ($hassiteconfig) {
$settings = new admin_settingpage("local_webhooks", $settings = new admin_settingpage("local_webhooks", new lang_string("pluginname", "local_webhooks"));
new lang_string("pluginname", "local_webhooks"));
$ADMIN->add("localplugins", $settings); $ADMIN->add("localplugins", $settings);
$settings->add(new admin_setting_configcheckbox( /* The switch of the interceptor of events */
"local_webhooks/enable", $settings->add(new admin_setting_configcheckbox("local_webhooks/enable", new lang_string("enable", "moodle"), new lang_string("enablews", "webservice"), false));
new lang_string("enable", "moodle"),
new lang_string("enablews", "webservice"),
false));
/* Link to the service manager */ /* Link to the service manager */
$linktext = new lang_string("managerservice", "local_webhooks"); $linktext = new lang_string("managerservice", "local_webhooks");
$linkurl = new moodle_url("/local/webhooks/managerservice.php"); $linkurl = new moodle_url("/local/webhooks/managerservice.php");
$settings->add(new admin_setting_heading("local_webhooks_managerservice", null, $settings->add(new admin_setting_heading("local_webhooks_managerservice", null, html_writer::link($linkurl, $linktext)));
html_writer::link($linkurl, $linktext)));
} }