Commit 3d55897c authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

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

parents bce01540 675a257b
......@@ -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