MDL-51107 navigationlib: Plugins can extend navigation category settings
authorFrederic Massart <fred@moodle.com>
Fri, 18 Sep 2015 09:06:52 +0000 (17:06 +0800)
committerFrederic Massart <fred@moodle.com>
Tue, 22 Sep 2015 13:58:50 +0000 (21:58 +0800)
lib/navigationlib.php
lib/upgrade.txt

index 19284f7..c650ae0 100644 (file)
@@ -4616,6 +4616,14 @@ class settings_navigation extends navigation_node {
             $categorynode->add(get_string('restorecourse', 'admin'), $url, self::TYPE_SETTING, null, 'restorecourse', new pix_icon('i/restore', ''));
         }
 
+        // Let plugins hook into category settings navigation.
+        $pluginsfunction = get_plugins_with_function('extend_navigation_category_settings', 'lib.php');
+        foreach ($pluginsfunction as $plugintype => $plugins) {
+            foreach ($plugins as $pluginfunction) {
+                $pluginfunction($categorynode, $catcontext);
+            }
+        }
+
         return $categorynode;
     }
 
index 3ff4060..6daec09 100644 (file)
@@ -138,6 +138,8 @@ information provided here is intended especially for developers.
 * external_api::validate_context now is public, it can be called from other classes.
 * rss_error() now supports returning of correct HTTP status of error and will return '404 Not Found'
   unless other status is specified.
+* Plugins can extend the navigation for categories settings by declaring the following callback:
+  <frankenstyle>_extend_navigation_category_settings(navigation_node, context_coursecat)
 
 === 2.9.1 ===