MDL-30506 navigation: Fixed up reference handling issue and added docs post integration

This commit is contained in:
Sam Hemelryk 2012-06-08 09:34:19 +12:00
parent a509cb29c3
commit a15e8b4101
2 changed files with 21 additions and 2 deletions

View File

@ -4400,9 +4400,9 @@ class settings_navigation extends navigation_node {
*/
protected function load_local_plugin_settings() {
// Get all local plugins with an extend_settings_navigation function in their lib.php file
foreach (get_plugin_list_with_function('local', 'extend_settings_navigation') as $function) {
foreach (get_plugin_list_with_function('local', 'extends_settings_navigation') as $function) {
// Call each function providing this (the settings navigation) and the current context.
call_user_func($function, $this, $this->context);
$function($this, $this->context);
}
}

View File

@ -205,6 +205,25 @@ You will need to write the /local/nicehack/externallib.php - external functions
description and code. See some examples from the core files (/user/externallib.php,
/group/externallib.php...).
Local plugin navigation hooks
-----------------------------
There are two functions that your plugin can define that allow it to extend the main
navigation and the settings navigation.
These two functions both need to be defined within /local/nicehack/lib.php.
sample code
<?php
function nicehack_extends_navigation(global_navigation $nav) {
// $nav is the global navigation instance.
// Here you can add to and manipulate the navigation structure as you like.
// This callback was introduced in 2.0
}
function local_nicehack_extends_settings_navigation(settings_navigation $nav, context $context) {
// $nav is the settings navigation instance.
// $context is the context the settings have been loaded for (settings is context specific)
// Here you can add to and manipulate the settings structure as you like.
// This callback was introduced in 2.3
}
Other local customisation files
===============================