MDL-56886 navigation: Allow local plugins to modify navigation via AJAX.

This commit is contained in:
Mikhail Golenkov
2019-11-26 13:01:14 +11:00
parent 417ff4f035
commit 95ca6f656e
+13 -3
View File
@@ -1483,9 +1483,7 @@ class global_navigation extends navigation_node {
}
// Give the local plugins a chance to include some navigation if they want.
foreach (get_plugin_list_with_function('local', 'extend_navigation') as $function) {
$function($this);
}
$this->load_local_plugin_navigation();
// Remove any empty root nodes
foreach ($this->rootnodes as $node) {
@@ -1517,6 +1515,15 @@ class global_navigation extends navigation_node {
return true;
}
/**
* This function gives local plugins an opportunity to modify navigation.
*/
protected function load_local_plugin_navigation() {
foreach (get_plugin_list_with_function('local', 'extend_navigation') as $function) {
$function($this);
}
}
/**
* Returns true if the current user is a parent of the user being currently viewed.
*
@@ -3261,6 +3268,9 @@ class global_navigation_for_ajax extends global_navigation {
$this->load_for_user(null, true);
}
// Give the local plugins a chance to include some navigation if they want.
$this->load_local_plugin_navigation();
$this->find_expandable($this->expandable);
return $this->expandable;
}