Commit 675a257b authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Checking that webservices is installed and active before displaying it's menu item



Bug 1419561

Change-Id: I72711b8a0d688abe7877ea32862cfc7b9db62b52
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 57035b28
......@@ -1489,6 +1489,21 @@ function safe_require_plugin($plugintype, $pluginname, $filename='lib.php', $fun
}
}
/**
* Check to see if a particular plugin is installed and is active by plugin name
*
* @param string $pluginname Name of plugin
* @return bool
*/
function is_plugin_active($pluginname) {
foreach (plugin_types() as $type) {
if (record_exists($type . '_installed', 'name', $pluginname, 'active', 1)) {
return true;
}
}
return false;
}
/**
* This function returns the list of plugintypes we currently care about.
*
......
......@@ -2327,13 +2327,16 @@ function admin_nav() {
'title' => get_string('cleanurls', 'admin'),
'weight' => 40,
),
'configextensions/webservices' => array(
);
if (is_plugin_active('webservice')) {
$menu['configextensions/webservices'] = array(
'path' => 'configextensions/webservices',
'url' => 'webservice/admin/index.php',
'title' => get_string('webservices', 'auth.webservice'),
'weight' => 50,
),
);
);
}
// Add the menu items for skins, if that feature is enabled
if (get_config('skins')) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment