From ce1a0d3cd8b1a7fc25f0a660f9117f424454dbea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Sat, 16 Mar 2013 02:05:19 +0100 Subject: [PATCH] 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. --- lib/pluginlib.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/pluginlib.php b/lib/pluginlib.php index f5fba435048..f0f93f7d4a2 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -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');