MDL-52237 navigationlib: Plugins can extend navigation user profile
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user