MDL-52237 navigationlib: Plugins can extend navigation user profile

This commit is contained in:
Jean-Philippe Gaudreau
2015-11-23 11:04:44 -05:00
parent 2b11b94c0c
commit 20dde5e674
2 changed files with 27 additions and 0 deletions
+20
View File
@@ -2342,6 +2342,15 @@ class global_navigation extends navigation_node {
}
}
// Let plugins hook into user navigation.
$pluginsfunction = get_plugins_with_function('extend_navigation_user', 'lib.php');
foreach ($pluginsfunction as $plugintype => $plugins) {
if ($plugintype != 'report') {
foreach ($plugins as $pluginfunction) {
$pluginfunction($usernode, $user, $usercontext, $course, $coursecontext);
}
}
}
}
return true;
}
@@ -4307,6 +4316,17 @@ class settings_navigation extends navigation_node {
}
$dashboard->add(get_string('grades', 'grades'), $url, self::TYPE_SETTING, null, 'mygrades');
}
// Let plugins hook into user navigation.
$pluginsfunction = get_plugins_with_function('extend_navigation_user', 'lib.php');
foreach ($pluginsfunction as $plugintype => $plugins) {
if ($plugintype != 'report') {
foreach ($plugins as $pluginfunction) {
$pluginfunction($profilenode, $user, $usercontext, $course, $coursecontext);
}
}
}
$usersetting = navigation_node::create(get_string('preferences', 'moodle'), $prefurl, self::TYPE_CONTAINER, null, $key);
$dashboard->add_node($usersetting);
} else {
+7
View File
@@ -1,6 +1,13 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 3.1 ===
* Plugins can extend the navigation for user by declaring the following callback:
<frankenstyle>_extend_navigation_user(navigation_node $parentnode, stdClass $user,
context_user $context, stdClass $course,
context_course $coursecontext)
=== 3.0 ===
* Minify updated to 2.2.1