MDL-38509 Implement new plugin_manager::get_plugin_types()

This new method just takes the result of the core get_plugin_types() and
re-orders the plugin types in the same way as they are displayed at the
Plugins overview screen.
This commit is contained in:
David Mudrák
2013-03-28 11:54:05 +01:00
parent c2c4f722b5
commit ce1a0d3cd8
+12 -2
View File
@@ -96,6 +96,17 @@ class plugin_manager {
}
}
/**
* Returns the result of {@link get_plugin_types()} ordered for humans
*
* @see self::reorder_plugin_types()
* @param bool $fullpaths false means relative paths from dirroot
* @return array (string)name => (string)location
*/
public function get_plugin_types($fullpaths = true) {
return $this->reorder_plugin_types(get_plugin_types($fullpaths));
}
/**
* Returns a tree of known plugins and information about them
*
@@ -119,8 +130,7 @@ class plugin_manager {
}
}
$this->pluginsinfo = array();
$plugintypes = get_plugin_types();
$plugintypes = $this->reorder_plugin_types($plugintypes);
$plugintypes = $this->get_plugin_types();
foreach ($plugintypes as $plugintype => $plugintyperootdir) {
if (in_array($plugintype, array('base', 'general'))) {
throw new coding_exception('Illegal usage of reserved word for plugin type');