Skip to content

Commit

Permalink
MDL-30506 navigation: Fixed up reference handling issue and added doc…
Browse files Browse the repository at this point in the history
…s post integration
  • Loading branch information
Sam Hemelryk committed Jun 7, 2012
1 parent a509cb2 commit a15e8b4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -4400,9 +4400,9 @@ protected function load_front_page_settings($forceopen = false) {
*/
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);
}
}

Expand Down
19 changes: 19 additions & 0 deletions local/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
===============================
Expand Down

0 comments on commit a15e8b4

Please sign in to comment.