mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
navigation MDL-22209 Added a callback for local plugins to allow them to add to the navigation.
This commit is contained in:
parent
d55a8be82b
commit
a683da3ca1
@ -808,7 +808,7 @@ class global_navigation extends navigation_node {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function initialise() {
|
public function initialise() {
|
||||||
global $SITE, $USER;
|
global $CFG, $SITE, $USER;
|
||||||
// Check if it has alread been initialised
|
// Check if it has alread been initialised
|
||||||
if ($this->initialised || during_initial_install()) {
|
if ($this->initialised || during_initial_install()) {
|
||||||
return true;
|
return true;
|
||||||
@ -912,6 +912,18 @@ class global_navigation extends navigation_node {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Give the local plugins a chance to include some navigation if they want.
|
||||||
|
foreach (get_list_of_plugins('local') as $plugin) {
|
||||||
|
if (!file_exists($CFG->dirroot.'/local/'.$plugin.'/lib.php')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
require_once($CFG->dirroot.'/local/'.$plugin.'/lib.php');
|
||||||
|
$function = $plugin.'_extends_navigation';
|
||||||
|
if (function_exists($function)) {
|
||||||
|
$function($this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove any empty root nodes
|
// Remove any empty root nodes
|
||||||
foreach ($this->rootnodes as $node) {
|
foreach ($this->rootnodes as $node) {
|
||||||
if (!$node->has_children()) {
|
if (!$node->has_children()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user