<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gaudreaj</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gaudreaj"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Gaudreaj"/>
	<updated>2026-04-18T05:29:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Moodle_3.1_release_notes&amp;diff=50282</id>
		<title>Moodle 3.1 release notes</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Moodle_3.1_release_notes&amp;diff=50282"/>
		<updated>2016-05-24T19:19:02Z</updated>

		<summary type="html">&lt;p&gt;Gaudreaj: /* Smaller new things */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Releases]] &amp;gt; {{FULLPAGENAME}}&lt;br /&gt;
 &lt;br /&gt;
Release date: 23 May 2016&lt;br /&gt;
&lt;br /&gt;
Here is [https://tracker.moodle.org/secure/IssueNavigator!executeAdvanced.jspa?jqlQuery=project+%3D+mdl+AND+resolution+%3D+fixed+AND+fixVersion+in+%28%223.1%22%29+ORDER+BY+priority+DESC&amp;amp;runQuery=true&amp;amp;clear=true the full list of fixed issues in 3.1].&lt;br /&gt;
&lt;br /&gt;
See our [https://docs.moodle.org/31/en/New_features New Features page] for a more user-friendly introduction to Moodle 3.1 with screenshots.&lt;br /&gt;
&lt;br /&gt;
If you are upgrading from previous version, make sure you read the [https://docs.moodle.org/31/en/Upgrading Upgrading] documentation. &lt;br /&gt;
&lt;br /&gt;
==Server requirements==&lt;br /&gt;
&lt;br /&gt;
These are just the minimum supported versions. We recommend keeping all of your software up-to-date.&lt;br /&gt;
&lt;br /&gt;
* Moodle upgrade:  Moodle 2.7 or later (if upgrading from earlier versions, you must upgrade to 2.7.14 as a first step)&lt;br /&gt;
* PHP version: minimum PHP 5.4.4 (always use latest PHP 5.4.x , 5.5.x or 5.6.x on Windows - http://windows.php.net/download/). PHP 7 is supported but has some [https://docs.moodle.org/dev/Moodle_and_PHP7#Can_I_use_PHP7_yet.3F engine limitations].&lt;br /&gt;
* Ghostscript should be installed for pdf annotation.&lt;br /&gt;
* Unoconv should be installed for file conversion used by pdf annotations (new in Moodle 3.1)&lt;br /&gt;
* &#039;&#039;&#039;New requirement for Moodle 3.1 comparing to 3.0&#039;&#039;&#039;: PHP extension &amp;lt;tt&amp;gt;xmlreader&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Database requirements ===&lt;br /&gt;
&lt;br /&gt;
Moodle supports the following database servers. Again, version numbers are just the minimum supported version. We recommend running the latest stable version of any software.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Database&lt;br /&gt;
! Minimum version&lt;br /&gt;
! Recommended&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.postgresql.org/ PostgreSQL]&lt;br /&gt;
| 9.1&lt;br /&gt;
| Latest&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mysql.com/ MySQL]&lt;br /&gt;
| 5.5.31&lt;br /&gt;
| Latest&lt;br /&gt;
|-&lt;br /&gt;
| [https://mariadb.org/ MariaDB]&lt;br /&gt;
| 5.5.31&lt;br /&gt;
| Latest&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.microsoft.com/en-us/server-cloud/products/sql-server/ Microsoft SQL Server]&lt;br /&gt;
| 2008&lt;br /&gt;
| Latest&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.oracle.com/us/products/database/overview/index.html Oracle Database]&lt;br /&gt;
| 10.2&lt;br /&gt;
| Latest&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Client requirements==&lt;br /&gt;
&lt;br /&gt;
=== Browser support ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Browser&lt;br /&gt;
! Minimum version&lt;br /&gt;
! Recommended version&lt;br /&gt;
! Notes&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.google.com/intl/en_au/chrome/browser/ Google Chrome]&lt;br /&gt;
| 30.0&lt;br /&gt;
| Latest&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mozilla.org/en-US/ Mozilla Firefox]&lt;br /&gt;
| 25.0&lt;br /&gt;
| Latest&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.apple.com/safari/ Apple Safari]&lt;br /&gt;
| 6&lt;br /&gt;
| Latest&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [http://windows.microsoft.com/en-AU/internet-explorer/download-ie Microsoft Internet Explorer]&lt;br /&gt;
| 9&lt;br /&gt;
| Latest&lt;br /&gt;
| Version 10 is required for drag-and-drop upload of content from outside the browser into Moodle&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Major features==&lt;br /&gt;
&lt;br /&gt;
===Highlights===&lt;br /&gt;
&lt;br /&gt;
* MDL-53451 - Competencies support in Moodle&lt;br /&gt;
* MDL-52954 - Improvements to the Assignment grading user interface&lt;br /&gt;
* MDL-31989 - [https://docs.moodle.org/31/en/Global_search Global Search] API allows to search forums, wikis and other content throughout the whole site. [https://docs.moodle.org/31/en/Global_search Installation and setup] of SOLR server is required, &lt;br /&gt;
* MDL-52002 - Significant performance improvements in gradebook calculations&lt;br /&gt;
* MDL-48012 - [https://docs.moodle.org/31/en/Recycle_bin Recycle bin] plugin is now part of standard Moodle distribution: allow instructors to &amp;quot;undo&amp;quot; deletions of course modules and courses. [https://moodleassociation.org/ Moodle Users Association] project&lt;br /&gt;
* MDL-49279 - Add support in moodle plugins for exporting &amp;quot;[[Moodle Mobile Remote add-ons|Mobile app addons]]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Forum===&lt;br /&gt;
&lt;br /&gt;
* MDL-372 - Allow to [https://docs.moodle.org/31/en/Using_Forum#Pinned_posts &amp;quot;pin&amp;quot; discussions] to keep them always on the top of the list&lt;br /&gt;
* MDL-34160 - Allow forum email subject to be customised&lt;br /&gt;
* MDL-47365 - Add  [https://docs.moodle.org/31/en/Using_Forum#Permalinks permalink] option to forum posts&lt;br /&gt;
* MDL-51214 - Rename the News forum to [https://docs.moodle.org/31/en/Announcements &amp;quot;Announcements&amp;quot;]&lt;br /&gt;
* MDL-44087 - Forum does not observe message notification settings for digest emails&lt;br /&gt;
* MDL-53050 - Highlight the selected forum post when deep linking with a #anchor&lt;br /&gt;
&lt;br /&gt;
===Assignment===&lt;br /&gt;
&lt;br /&gt;
* MDL-52397 - Feedback for Assignments is not sent if the assignment grade timemodified setting was set to two days ago&lt;br /&gt;
* MDL-52596 - Add a &#039;maxperpage&#039; site wide setting for grading table size (to mitigate broken grading pages in large courses)&lt;br /&gt;
* MDL-52269 - Not obvious to tell if an assignment is in blind marking if user holds the &amp;quot;mod/assign:viewblinddetails&amp;quot; capabilty&lt;br /&gt;
* MDL-52270 - Difficult to cross reference users with their blind identities&lt;br /&gt;
* MDL-44598 - List student names on &#039;grant extension&#039; screen&lt;br /&gt;
* MDL-52490 - Download selected assign submissions as a zip file&lt;br /&gt;
* MDL-52290 - EditPDF - Also show the total page number in the pagination&lt;br /&gt;
* MDL-52489 - &amp;quot;Download all submissions as a zip&amp;quot; should maintain the folder structure in students submissions&lt;br /&gt;
&lt;br /&gt;
===External tool (LTI)===&lt;br /&gt;
&lt;br /&gt;
* MDL-52154 - Rework LTI admin screens&lt;br /&gt;
* MDL-45064 - Option to add Preconfigured LTI Tool to Activity Chooser&lt;br /&gt;
* MDL-52035 - Integrate LTI Provider support in Moodle as the [https://docs.moodle.org/31/en/Publish_as_LTI_tool Publish as LTI tool]&lt;br /&gt;
* MDL-52821 - Compliance: Send tool_consumer_instance_description in LTI launch request&lt;br /&gt;
&lt;br /&gt;
===Feedback===&lt;br /&gt;
&lt;br /&gt;
* MDL-53738 - Feedback activity module will be enabled by default in new 3.1 installations. If you are upgrading to 3.1 we recommend you to enable it manually.&lt;br /&gt;
* MDL-52094 - Various improvements to UI and bug fixes, including:&lt;br /&gt;
** Performance improvement to download responses as raw data in multiple formats (CSV, Excel, etc.) - now available on &amp;quot;Show responses&amp;quot; page instead of &amp;quot;Analysis&amp;quot;&lt;br /&gt;
** Allow any characters in labels, do not display empty labels&lt;br /&gt;
** Do not display empty pages&lt;br /&gt;
** Map frontpage feedback to multiple courses without leaving the form&lt;br /&gt;
** Improved display of automatic question numbers&lt;br /&gt;
** Disable &amp;quot;Response time&amp;quot; for anonymous feedbacks&lt;br /&gt;
** Use moodleforms to display feedback&lt;br /&gt;
&lt;br /&gt;
===SCORM===&lt;br /&gt;
&lt;br /&gt;
* MDL-45712 - Add Result field to the SCORM Interactions Report&lt;br /&gt;
* MDL-48680 - Add score and status submission events to SCORM activity&lt;br /&gt;
* MDL-42473 - Add group support to SCORM activity&lt;br /&gt;
&lt;br /&gt;
===Quiz===&lt;br /&gt;
&lt;br /&gt;
* MDL-52738 - Quiz attempt/review page should have a previous button to match next&lt;br /&gt;
* MDL-46092 - Add the OU styling of the Quiz navigation into Moodle core as the default&lt;br /&gt;
* MDL-46091 - Rationalise confirmations when you start a quiz&lt;br /&gt;
* MDL-52806 - Show right answers when manually grading automatically marked questions&lt;br /&gt;
* MDL-53304 - Immediate feedback behaviours should not show a disabled check button when you can&#039;t use it&lt;br /&gt;
&lt;br /&gt;
===Other activity modules===&lt;br /&gt;
&lt;br /&gt;
* MDL-42190 - Workshop: Possibility to delete a submission&lt;br /&gt;
* MDL-51306 - Folder: [https://docs.moodle.org/31/en/Folder_resource Bulk download all files within a folder activity as ZIP file]&lt;br /&gt;
* MDL-52414 - Lesson: Allow Default Settings for [https://docs.moodle.org/31/en/Lesson_settings Lesson Module Settings]&lt;br /&gt;
* MDL-51267 - URL/File: Make setting up a [https://docs.moodle.org/31/en/URL_resource_settings#General URL]/[https://docs.moodle.org/31/en/File_resource_settings#Uploading_files File] resource more obvious&lt;br /&gt;
* MDL-50794 - Workshop: [https://docs.moodle.org/31/en/Workshop_settings Restricting file types as attachments] to a workshop&lt;br /&gt;
&lt;br /&gt;
===Gradebook===&lt;br /&gt;
&lt;br /&gt;
* MDL-48634 - Option to rescale existing grades when changing max points&lt;br /&gt;
* MDL-52522 - grade_minmaxtouse should be respected for overridden categories&lt;br /&gt;
* MDL-51900 - Tab Down Grade Column in Single View of Gradebook&lt;br /&gt;
* MDL-52309 - Make Grade History report require user to submit parameters before the report starts running&lt;br /&gt;
&lt;br /&gt;
===Performance===&lt;br /&gt;
&lt;br /&gt;
* MDL-51374 - Do not purge entire databasemeta cache when there are structure changes (esp temp tables).&lt;br /&gt;
* MDL-51603 - Refactor downloading of csv, ods, excel etc files in reports and exports across moodle to stream progressively&lt;br /&gt;
* MDL-34925 - Improve bulk user export performance&lt;br /&gt;
* MDL-50385 - Performance improvement to the grade history report&lt;br /&gt;
&lt;br /&gt;
===Tagging===&lt;br /&gt;
&lt;br /&gt;
* MDL-50851 - Introduce tag collections - ability to separate independent tag areas&lt;br /&gt;
* MDL-52252 - Add tags to modules (Resources and Activities)&lt;br /&gt;
* MDL-25742 - Allow to search wiki pages by tags&lt;br /&gt;
* MDL-51283 - Rename &amp;quot;official&amp;quot; tags to &amp;quot;standard&amp;quot;, allow admin to set for each tag area how to use standard tags&lt;br /&gt;
* MDL-16855 - Add tag filtering to &amp;quot;Manage tags&amp;quot; page&lt;br /&gt;
* MDL-52707 - Allow tags to be combined&lt;br /&gt;
&lt;br /&gt;
===Usability===&lt;br /&gt;
&lt;br /&gt;
* MDL-27628 - [https://docs.moodle.org/31/en/Course_meta_link Enrol meta:] Possible to add multiple courses without leaving the form&lt;br /&gt;
* MDL-51818 - Move the profile &#039;Message&#039; button to be next to the user picture&lt;br /&gt;
* MDL-52258 - Calendar now shows duration in calendar block&lt;br /&gt;
* MDL-53043 - Move user search box above the students list in the manual enrolments popup&lt;br /&gt;
* MDL-35590 - Navigation block redesign to meet ARIA specification&lt;br /&gt;
* MDL-49963 - Allow to message all participants when there are more than one page in participants list&lt;br /&gt;
* MDL-51354 - Help popup and improved name for events dropdown menu on the course and site logs pages&lt;br /&gt;
* MDL-53026 - Use inplace editable for editing cohort names&lt;br /&gt;
* MDL-51706 - Move plagiarism links to the top of the summary and full text outputs&lt;br /&gt;
* MDL-53382 - &amp;quot;Show all&amp;quot; link on participants page should be moved beneath the page switcher&lt;br /&gt;
&lt;br /&gt;
===Other improvements===&lt;br /&gt;
&lt;br /&gt;
* MDL-53057 - Add [https://docs.moodle.org/31/en/File_system_repository#Using_a_File_System_repository_file search feature to the File system repository]&lt;br /&gt;
* MDL-48506 - Improve memcached cache store so that it is multi-site safe&lt;br /&gt;
* MDL-50661 - Restyle &amp;quot;Clean&amp;quot; theme to use Logo and Header in Frontpage with smaller logo option in other pages.&lt;br /&gt;
* MDL-36652 - When downloading an Excel spreadsheet of student logs, have the course short name included in the file name. &lt;br /&gt;
* MDL-53207 - Display stock avatar instead of own user picture from messages from fake users&lt;br /&gt;
* MDL-51698 - Markup the crumb trail so search engines understand it and leverage it&lt;br /&gt;
* MDL-53072 - Option to choose whether we include suspended users when auto-creating groups&lt;br /&gt;
* MDL-52869 - Convert inline activity name edit to use the inplace editable element&lt;br /&gt;
&lt;br /&gt;
===For administrators===&lt;br /&gt;
&lt;br /&gt;
* MDL-26935 - New capability to control role renaming&lt;br /&gt;
* MDL-28030 - Add config.php settings to allow plugins to rewrite output moodle_urls (eg clean / semantic urls)&lt;br /&gt;
* MDL-52752 - Administrators can specify an alternate URL to use for MathJax&lt;br /&gt;
* MDL-52219 - Completion tracking &amp;amp; availability should default to on for new installs&lt;br /&gt;
* MDL-52990 - Enable all emails to be themed, ie add 4 wrapper mustache templates&lt;br /&gt;
* MDL-53260 - Option to display CLI upgrade messages in English&lt;br /&gt;
* MDL-52386 - Allow to control field for flagging enabled/disabled users in LDAP authentication (useful for Active Directory)&lt;br /&gt;
* MDL-52383 - Calendar &amp;quot;Days to look ahead&amp;quot; should allow intervals up to 1 year&lt;br /&gt;
* MDL-49934 - Admins or managers should be able to retrieve assignments info via get_assignments web service&lt;br /&gt;
&lt;br /&gt;
==Security issues==&lt;br /&gt;
&lt;br /&gt;
There are no security issues included in this release, please refer to [https://docs.moodle.org/dev/Moodle_3.0.4_release_notes Moodle 3.0.4 release notes]&lt;br /&gt;
&lt;br /&gt;
==For developers==&lt;br /&gt;
&lt;br /&gt;
===Significant new areas===&lt;br /&gt;
&lt;br /&gt;
* MDL-31989 - [https://docs.moodle.org/dev/Search_API Global Search] API allows to index and search forums, wikis and other content throughout the whole site.&lt;br /&gt;
* MDL-49279, MDL-50032 - Add support in moodle plugins for exporting &amp;quot;[[Moodle Mobile Remote add-ons|Mobile app addons]]&amp;quot;&lt;br /&gt;
* MDL-53451 - Competencies support in Moodle ([https://docs.moodle.org/dev/Competency_API documentation])&lt;br /&gt;
* MDL-50887 - Implement plugins infrastructure for antivirus and create ClamAV plugin ([https://docs.moodle.org/dev/Antivirus_plugins documentation]).&lt;br /&gt;
* MDL-51603 - New [https://docs.moodle.org/dev/Data_formats Dataformat] plugin type for downloading data as csv, ods, excel etc (eg from table_sql export)&lt;br /&gt;
* MDL-50851 - Significant changes to Tags API, tag areas can now implement callbacks to display tagged items ([https://docs.moodle.org/dev/Tag_API documentation])&lt;br /&gt;
* MDL-46891 - Upgrade to behat 3.x ([https://docs.moodle.org/dev/Acceptance_testing/Migrating_from_Behat_2.5_to_3.x_in_Moodle documentation])&lt;br /&gt;
&lt;br /&gt;
===Smaller new things===&lt;br /&gt;
&lt;br /&gt;
* MDL-51802 - Reusable element for inplace editing ([https://docs.moodle.org/dev/Inplace_editable documentation])&lt;br /&gt;
* MDL-30811 - Introduce notification stack to moodle sessions ([https://docs.moodle.org/dev/Notifications documentation])&lt;br /&gt;
* MDL-52237 - Add a callback to inject nodes in the user profile navigation ([https://docs.moodle.org/dev/Navigation_API#User_profile documentation])&lt;br /&gt;
* MDL-51324 - New course chooser element for moodleforms ([https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#autocomplete documentation])&lt;br /&gt;
* MDL-53311 - Reusable element for displaying tree similar to navigation tree ([https://docs.moodle.org/dev/Tree documentation])&lt;br /&gt;
&lt;br /&gt;
===Smaller changes in core APIs===&lt;br /&gt;
&lt;br /&gt;
* MDL-52954 - file_storage class can now convert between office documents ([https://docs.moodle.org/dev/File_API#Convert_between_file_formats_.28office_documents.29 documentation])&lt;br /&gt;
* MDL-53274 - Throw exception (in developer mode) if page context is not set, otherwise it is easily missed in AJAX calls&lt;br /&gt;
* MDL-52826, MDL-52715 - Allow to use moodleforms in AJAX requests ([https://docs.moodle.org/dev/Fragment documentation])&lt;br /&gt;
* MDL-51718 - Allow to specify scheme in moodle_url&lt;br /&gt;
* MDL-51700 - Ajax service should clean the return values of the external functions&lt;br /&gt;
* MDL-53962 - &#039;&#039;&#039;Changes to webservices XML-RPC API&#039;&#039;&#039; - it is now &#039;&#039;&#039;critical&#039;&#039;&#039; to specify parameters for XML-RPC calls in the correct order. Previously Zend may have been able to work out the order, our new implementation, at this stage, cannot.&lt;br /&gt;
&lt;br /&gt;
===Themeability improvements===&lt;br /&gt;
&lt;br /&gt;
* MDL-50464 - New renderer for RSS Client Block allows themes to customise its look&lt;br /&gt;
&lt;br /&gt;
===Changes related to particular plugins===&lt;br /&gt;
&lt;br /&gt;
* MDL-52013 - Allow mod_assign plugins to add calendar events&lt;br /&gt;
* MDL-48362 - Improve the enrol API to prevent logic in the UI ([https://docs.moodle.org/dev/Enrolment_plugins#Standard_Editing_UI documentation])&lt;br /&gt;
* MDL-52996 - Allow Atto customisation for special-purpose plugins&lt;br /&gt;
* MDL-52781 - Improved validation on user fields when creating users from external datasources&lt;br /&gt;
* MDL-53304 - Changes to interactive question behaviour may cause the unit tests for your question type to break if you have followed the common patter. You will need to make changes like [https://github.com/moodle/moodle/commit/81e47a35e8bb98a94ea88e45eee63dcda1b46f74#diff-d16a78021131604bb14ae59ebe6eeebbL235 this].&lt;br /&gt;
&lt;br /&gt;
===Deprecations===&lt;br /&gt;
&lt;br /&gt;
For full list of deprecations refer to lib/upgrade.txt and upgrade.txt files in the folder where the particular plugin is located. Here are the most major deprecations:&lt;br /&gt;
&lt;br /&gt;
* MDL-49414 - Remove deprecated web services&lt;br /&gt;
* MDL-48621 - Deprecate the old events system&lt;br /&gt;
* MDL-52207 - Delete Zend framework&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Moodle 3.0 release notes]]&lt;br /&gt;
 &lt;br /&gt;
[[Category:Release notes]]&lt;br /&gt;
[[Category:Moodle 3.1]]&lt;br /&gt;
 &lt;br /&gt;
[[fr:Notes de mise à jour de Moodle 3.1]]&lt;br /&gt;
[[es:Notas de Moodle 3.1]]&lt;/div&gt;</summary>
		<author><name>Gaudreaj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Navigation_API&amp;diff=50281</id>
		<title>Navigation API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Navigation_API&amp;diff=50281"/>
		<updated>2016-05-24T19:18:00Z</updated>

		<summary type="html">&lt;p&gt;Gaudreaj: /* User profile */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
The Navigation API allows for the manipulation of the navigation system used in Moodle.&lt;br /&gt;
&lt;br /&gt;
==What the navigation is==&lt;br /&gt;
It&#039;s very important to understand what the navigation is exactly within Moodle. One of the goals for Moodle 2.0 was to standardise navigation throughout Moodle and try to bring order to the structure of a Moodle site.  Navigation is available through the page object &#039;&#039;&#039;$PAGE&#039;&#039;&#039;, against which you set the heading for the page, the title, any JavaScript requirements, etc.  The navigation structure uses the information $PAGE contains to generate a navigation structure for the site.  The navigation or settings [[blocks]] are interpretations of the navigation structure Moodle creates.&lt;br /&gt;
&lt;br /&gt;
This navigation structure is available through three variables:&lt;br /&gt;
&lt;br /&gt;
; $PAGE-&amp;gt;navigation : This is the main navigation structure, it will contain items that will allow the user to browse to the other available pages.&lt;br /&gt;
; $PAGE-&amp;gt;settingsnav : This is the settings navigation structure contains items that will allow the user to edit settings.&lt;br /&gt;
; $PAGE-&amp;gt;navbar : The navbar is a special structure for page breadcrumbs.&lt;br /&gt;
&lt;br /&gt;
==What the navigation is not==&lt;br /&gt;
The navigation is &#039;&#039;&#039;NOT&#039;&#039;&#039; the navigation block or the settings block!  These two blocks were created to display the navigation structure. The navigation block looks at &#039;&#039;$PAGE-&amp;gt;navigation&#039;&#039;, and the settings block looks at &#039;&#039;$PAGE-&amp;gt;settingsnav&#039;&#039;.  Both blocks interpret their data into an HTML structure and render it.&lt;br /&gt;
&lt;br /&gt;
# The navigation is a back-end structure that is built behind the scenes and has no immediate method of display.&lt;br /&gt;
# The navigation and settings blocks display the back-end navigation structure but add nothing to it at all.&lt;br /&gt;
::In the [[model-view-controller pattern]], $PAGE-&amp;gt;navigation, $PAGE-&amp;gt;settingsnav, and $PAGE-&amp;gt;navbar are the models, and the blocks are views.&lt;br /&gt;
&lt;br /&gt;
The navbar is just the path to the active navigation or settings item. The navbar is not displayed by a block; instead it is added into the theme&#039;s layout files and displayed by the core renderer. &lt;br /&gt;
&lt;br /&gt;
==How the navigation works==&lt;br /&gt;
&lt;br /&gt;
The main navigation structure can be accessed through &#039;&#039;&#039;$PAGE-&amp;gt;navigation&#039;&#039;&#039;.  The navigation and settings are contextual in that they will relate to the page that the user is viewing. This is determined by other $PAGE object properties:&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;context&#039;&#039;&#039; is a Moodle context that immediately outlines the nature of the page the user is viewing.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;course&#039;&#039;&#039; is the course the user is viewing.  This is essential if the context is CONTEXT_COURSE or greater.  However, it is also useful in other contexts such as CONTEXT_USER.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;cm&#039;&#039;&#039; is the course module instance.  This is essential if the context is CONTEXT_MODULE or greater.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;url&#039;&#039;&#039; is used to match the active navigation item. &lt;br /&gt;
&lt;br /&gt;
Nearly every page sets $PAGE-&amp;gt;url through a call to &#039;&#039;&#039;$PAGE-&amp;gt;set_url&#039;&#039;&#039; however not many explicitly set the context, course, or cm. When you call &#039;&#039;&#039;require_login&#039;&#039;&#039; with a course or cm it automatically calls the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if ($cm) {&lt;br /&gt;
    $PAGE-&amp;gt;set_cm($cm, $course); // sets up global $COURSE&lt;br /&gt;
} else {&lt;br /&gt;
    $PAGE-&amp;gt;set_course($course);// sets up global $COURSE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A page will only be required to explicitly set a context, course, or cm under one of these conditions:&lt;br /&gt;
# &#039;&#039;&#039;require_login&#039;&#039;&#039; is NOT being called correctly&lt;br /&gt;
# The page is using CONTEXT_SYSTEM, CONTEXT_COURSECAT, or CONTEXT_USER (call &#039;&#039;&#039;$PAGE-&amp;gt;set_context&#039;&#039;&#039; ).&lt;br /&gt;
# The page is using a course or cm but it is also using one of the above contexts (call &#039;&#039;&#039;$PAGE-&amp;gt;set_course&#039;&#039;&#039; or &#039;&#039;&#039;$PAGE-&amp;gt;set_cm&#039;&#039;&#039; ).&lt;br /&gt;
&lt;br /&gt;
The navigation structure cannot be generated before the $PAGE object is configured. It is only generated when it is first used, either when something tries to access the structure or when code tries to add to it.  The navigation is initialised in a specific order:&lt;br /&gt;
# Main navigation structure&lt;br /&gt;
# Settings navigation&lt;br /&gt;
# Navbar (does not need to be generated because of its simple contents and rendering)&lt;br /&gt;
&lt;br /&gt;
==Extending the navigation==&lt;br /&gt;
&lt;br /&gt;
===Code extension===&lt;br /&gt;
This method of extending is when the code arbitrarily extends the navigation during its execution. Extending the navigation through this means allows you to extend the navigation anywhere easily, however it will only be shown on pages where your extending code gets called (you should probably put it in a function within lib.php).&lt;br /&gt;
&lt;br /&gt;
These examples are taken from the [http://moodle.org/mod/forum/discuss.php?d=152391 General Developer Forum: Moodle 2 - how to set up breadcrumbs for a module page]. It has further information that is well worth reading.&lt;br /&gt;
====Navigation====&lt;br /&gt;
This is extending the main navigation structure.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$previewnode = $PAGE-&amp;gt;navigation-&amp;gt;add(get_string(&#039;preview&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;), navigation_node::TYPE_CONTAINER);&lt;br /&gt;
$thingnode = $previewnode-&amp;gt;add(get_string(&#039;name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above lines of code adds a preview node to the bottom of the navigation and then adds a thingnode to the previewnode (adding a leaf to our tree).&lt;br /&gt;
The final line of code makes the thingnode active so that the navbar finds it however if the URL you give it is the same as the url you set for the page it will automatically be marked active and you won&#039;t need this call.&lt;br /&gt;
&lt;br /&gt;
Next extending the navigation for the course.&lt;br /&gt;
For this you will need to know the course id and have called require_login($courseorid); so that the navigation is loaded for the course.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$coursenode = $PAGE-&amp;gt;navigation-&amp;gt;find($courseid, navigation_node::TYPE_COURSE);&lt;br /&gt;
$thingnode = $coursenode-&amp;gt;add(get_string(&#039;Name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The new bit of code here really is the first line which simply finds the course node, to do this we give it the course id and the node type in this case TYPE_COURSE.&lt;br /&gt;
What we are doing here is relying on the navigation to generate the navigation up to the course and then just adding to the course.&lt;br /&gt;
&lt;br /&gt;
Note that Moodle loads plugins in alphabetical order. Therefore plugin_b can find a node added by plugin_a but not the other way around.&lt;br /&gt;
====Settings navigation====&lt;br /&gt;
Adding to the settings navigation is very similar to navigation&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$settingnode = $PAGE-&amp;gt;settingsnav-&amp;gt;add(get_string(&#039;setting&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;), navigation_node::TYPE_CONTAINER);&lt;br /&gt;
$thingnode = $settingnode-&amp;gt;add(get_string(&#039;Name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Add Settings folder to navigation====&lt;br /&gt;
&lt;br /&gt;
An example of a settings folder in a module can be see by navigating to Site administration / Plugins / Activity modules / Assignment. &lt;br /&gt;
&lt;br /&gt;
[[File:assignmentmenu.png]]&lt;br /&gt;
&lt;br /&gt;
An example of adding a navigation folder to a settings.php for a block with a link to the settings page and a external page is bellow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
defined(&#039;MOODLE_INTERNAL&#039;) || die;&lt;br /&gt;
&lt;br /&gt;
// Create folder / submenu in block menu, modsettings for activity modules, localplugins for Local plugins. &lt;br /&gt;
// The default folders are defined in admin/settings/plugins.php.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksettings&#039;, new admin_category(&#039;blocksamplefolder&#039;,&lt;br /&gt;
        get_string(&#039;pluginname&#039;, &#039;mod_sample&#039;)));&lt;br /&gt;
&lt;br /&gt;
// Create settings block.&lt;br /&gt;
$settings = new admin_settingpage($section, get_string(&#039;settings&#039;, &#039;block_sample&#039;));&lt;br /&gt;
if ($ADMIN-&amp;gt;fulltree) {&lt;br /&gt;
    $settings-&amp;gt;add(new admin_setting_configcheckbox(&#039;block_sample_checkbox&#039;, get_string(&#039;checkbox&#039;, &#039;block_sample&#039;),&lt;br /&gt;
        get_string(&#039;checkboxdescription&#039;, &#039;block_kronoshtml&#039;), 0));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// This adds the settings link to the folder/submenu.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksamplefolder&#039;, $settings);&lt;br /&gt;
// This adds a link to an external page.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksamplefolder&#039;, new admin_externalpage(&#039;block_sample_page&#039;, get_string(&#039;externalpage&#039;, &#039;block_sample&#039;),&lt;br /&gt;
        $CFG-&amp;gt;wwwroot.&#039;/blocks/sample/sample.php&#039;));&lt;br /&gt;
// Prevent Moodle from adding settings block in standard location.&lt;br /&gt;
$settings = null;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Navbar====&lt;br /&gt;
This is extending the settings navigation.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;ignore_active();&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;add(get_string(&#039;preview&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;add(get_string(&#039;name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above code tells the navbar to ignore what ever the active page was and just use what you add, at which point we add two items as shown.&lt;br /&gt;
===Plugin Callbacks===&lt;br /&gt;
These are specific functions that the navigation looks for and calls if they exist for the plugin, presently only three plugin types can extend the navigation through these call-backs.&lt;br /&gt;
&lt;br /&gt;
Ideally all entries in &amp;quot;Administration / Site administration&amp;quot; tree should be done via settings.php files but sometimes it may be easier to directly modify the navigation structure created from the admin settings tree (such as when adding links to external pages).&lt;br /&gt;
&lt;br /&gt;
====Module====&lt;br /&gt;
Modules have two call-back methods, first to extend the navigation, and second to extend the settings. These call-backs get called when ever the user is viewing a page within the module and should only extend the navigation for the module.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function {modulename}_extend_navigation(${modulename}node, $course, $module, $cm)&lt;br /&gt;
function {modulename}_extend_settings_navigation($settings, ${modulename}node)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Course Formats====&lt;br /&gt;
Course formats are able to completely redefine the way in which navigation is generated for a course, as well as this they also have several methods to ensure the navigation is generated correctly.&lt;br /&gt;
&lt;br /&gt;
====Course Reports====&lt;br /&gt;
By default reports don&#039;t add themselves or anything else to the navigation however there is a call-back that can be implemented to allow them to do so.&lt;br /&gt;
&lt;br /&gt;
====Local Plugins====&lt;br /&gt;
{{Moodle 2.9}}Local plugins have two call-back methods, first to extend the navigation, and second to extend the settings.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_{pluginname}_extend_navigation(global_navigation $nav)&lt;br /&gt;
function local_{pluginname}_extend_settings_navigation(settings_navigation $nav, context $context)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In versions before Moodle 2.9, the supported callbacks have &amp;lt;tt&amp;gt;_extends_&amp;lt;/tt&amp;gt; (not imperative mood) in their names. This was a consistency bug fixed in MDL-49643.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_{pluginname}_extends_navigation(global_navigation $nav)&lt;br /&gt;
function local_{pluginname}_extends_settings_navigation(settings_navigation $nav, context $context)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Course settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the course settings navigation. Prior to 3.0 only &#039;&#039;reports&#039;&#039; and &#039;&#039;admin tools&#039;&#039; could extend the course settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_course(navigation_node $parentnode, stdClass $course, context_course $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====User settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the user settings navigation. Prior to 3.0 only &#039;&#039;admin tools&#039;&#039; could extend the user settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_user_settings(navigation_node $parentnode, stdClass $user, context_user $context, stdClass $course, context_course $coursecontext);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Category settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the category settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_category_settings(navigation_node $parentnode, context_coursecat $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Frontpage settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the frontpage settings navigation. Prior to 3.0 only &#039;&#039;admin tools&#039;&#039; could extend the frontpage settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_frontpage(navigation_node $parentnode, stdClass $course, context_course $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====User profile====&lt;br /&gt;
{{Moodle 3.1}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the user profile navigation.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_user(navigation_node $parentnode, stdClass $user, context_user $context, stdClass $course, context_course $coursecontext);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FAQ&#039;s and troubleshooting==&lt;br /&gt;
&#039;&#039;&#039;Q.&#039;&#039;&#039; My page is on the navigation but it doesn&#039;t find it?&lt;br /&gt;
&lt;br /&gt;
The first thing to do here is check the URL you are setting for the page. It should match the URL your page has within the navigation. If it doesn&#039;t you have two options, first change your &#039;&#039;&#039;$PAGE-&amp;gt;set_url&#039;&#039;&#039; call, or second override the URL the navigation is using to find the active node as shown below:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
navigation_node::override_active_url(new moodle_url(&#039;/your/url/here.php&#039;, array(&#039;param&#039;=&amp;gt;&#039;value&#039;)));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Core APIs]]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=170325&amp;amp;parent=753095 Forum discussion - adding navigation to local plugins]&lt;br /&gt;
&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Gaudreaj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Navigation_API&amp;diff=50280</id>
		<title>Navigation API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Navigation_API&amp;diff=50280"/>
		<updated>2016-05-24T19:16:46Z</updated>

		<summary type="html">&lt;p&gt;Gaudreaj: /* User Profile */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
The Navigation API allows for the manipulation of the navigation system used in Moodle.&lt;br /&gt;
&lt;br /&gt;
==What the navigation is==&lt;br /&gt;
It&#039;s very important to understand what the navigation is exactly within Moodle. One of the goals for Moodle 2.0 was to standardise navigation throughout Moodle and try to bring order to the structure of a Moodle site.  Navigation is available through the page object &#039;&#039;&#039;$PAGE&#039;&#039;&#039;, against which you set the heading for the page, the title, any JavaScript requirements, etc.  The navigation structure uses the information $PAGE contains to generate a navigation structure for the site.  The navigation or settings [[blocks]] are interpretations of the navigation structure Moodle creates.&lt;br /&gt;
&lt;br /&gt;
This navigation structure is available through three variables:&lt;br /&gt;
&lt;br /&gt;
; $PAGE-&amp;gt;navigation : This is the main navigation structure, it will contain items that will allow the user to browse to the other available pages.&lt;br /&gt;
; $PAGE-&amp;gt;settingsnav : This is the settings navigation structure contains items that will allow the user to edit settings.&lt;br /&gt;
; $PAGE-&amp;gt;navbar : The navbar is a special structure for page breadcrumbs.&lt;br /&gt;
&lt;br /&gt;
==What the navigation is not==&lt;br /&gt;
The navigation is &#039;&#039;&#039;NOT&#039;&#039;&#039; the navigation block or the settings block!  These two blocks were created to display the navigation structure. The navigation block looks at &#039;&#039;$PAGE-&amp;gt;navigation&#039;&#039;, and the settings block looks at &#039;&#039;$PAGE-&amp;gt;settingsnav&#039;&#039;.  Both blocks interpret their data into an HTML structure and render it.&lt;br /&gt;
&lt;br /&gt;
# The navigation is a back-end structure that is built behind the scenes and has no immediate method of display.&lt;br /&gt;
# The navigation and settings blocks display the back-end navigation structure but add nothing to it at all.&lt;br /&gt;
::In the [[model-view-controller pattern]], $PAGE-&amp;gt;navigation, $PAGE-&amp;gt;settingsnav, and $PAGE-&amp;gt;navbar are the models, and the blocks are views.&lt;br /&gt;
&lt;br /&gt;
The navbar is just the path to the active navigation or settings item. The navbar is not displayed by a block; instead it is added into the theme&#039;s layout files and displayed by the core renderer. &lt;br /&gt;
&lt;br /&gt;
==How the navigation works==&lt;br /&gt;
&lt;br /&gt;
The main navigation structure can be accessed through &#039;&#039;&#039;$PAGE-&amp;gt;navigation&#039;&#039;&#039;.  The navigation and settings are contextual in that they will relate to the page that the user is viewing. This is determined by other $PAGE object properties:&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;context&#039;&#039;&#039; is a Moodle context that immediately outlines the nature of the page the user is viewing.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;course&#039;&#039;&#039; is the course the user is viewing.  This is essential if the context is CONTEXT_COURSE or greater.  However, it is also useful in other contexts such as CONTEXT_USER.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;cm&#039;&#039;&#039; is the course module instance.  This is essential if the context is CONTEXT_MODULE or greater.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;url&#039;&#039;&#039; is used to match the active navigation item. &lt;br /&gt;
&lt;br /&gt;
Nearly every page sets $PAGE-&amp;gt;url through a call to &#039;&#039;&#039;$PAGE-&amp;gt;set_url&#039;&#039;&#039; however not many explicitly set the context, course, or cm. When you call &#039;&#039;&#039;require_login&#039;&#039;&#039; with a course or cm it automatically calls the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if ($cm) {&lt;br /&gt;
    $PAGE-&amp;gt;set_cm($cm, $course); // sets up global $COURSE&lt;br /&gt;
} else {&lt;br /&gt;
    $PAGE-&amp;gt;set_course($course);// sets up global $COURSE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A page will only be required to explicitly set a context, course, or cm under one of these conditions:&lt;br /&gt;
# &#039;&#039;&#039;require_login&#039;&#039;&#039; is NOT being called correctly&lt;br /&gt;
# The page is using CONTEXT_SYSTEM, CONTEXT_COURSECAT, or CONTEXT_USER (call &#039;&#039;&#039;$PAGE-&amp;gt;set_context&#039;&#039;&#039; ).&lt;br /&gt;
# The page is using a course or cm but it is also using one of the above contexts (call &#039;&#039;&#039;$PAGE-&amp;gt;set_course&#039;&#039;&#039; or &#039;&#039;&#039;$PAGE-&amp;gt;set_cm&#039;&#039;&#039; ).&lt;br /&gt;
&lt;br /&gt;
The navigation structure cannot be generated before the $PAGE object is configured. It is only generated when it is first used, either when something tries to access the structure or when code tries to add to it.  The navigation is initialised in a specific order:&lt;br /&gt;
# Main navigation structure&lt;br /&gt;
# Settings navigation&lt;br /&gt;
# Navbar (does not need to be generated because of its simple contents and rendering)&lt;br /&gt;
&lt;br /&gt;
==Extending the navigation==&lt;br /&gt;
&lt;br /&gt;
===Code extension===&lt;br /&gt;
This method of extending is when the code arbitrarily extends the navigation during its execution. Extending the navigation through this means allows you to extend the navigation anywhere easily, however it will only be shown on pages where your extending code gets called (you should probably put it in a function within lib.php).&lt;br /&gt;
&lt;br /&gt;
These examples are taken from the [http://moodle.org/mod/forum/discuss.php?d=152391 General Developer Forum: Moodle 2 - how to set up breadcrumbs for a module page]. It has further information that is well worth reading.&lt;br /&gt;
====Navigation====&lt;br /&gt;
This is extending the main navigation structure.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$previewnode = $PAGE-&amp;gt;navigation-&amp;gt;add(get_string(&#039;preview&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;), navigation_node::TYPE_CONTAINER);&lt;br /&gt;
$thingnode = $previewnode-&amp;gt;add(get_string(&#039;name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above lines of code adds a preview node to the bottom of the navigation and then adds a thingnode to the previewnode (adding a leaf to our tree).&lt;br /&gt;
The final line of code makes the thingnode active so that the navbar finds it however if the URL you give it is the same as the url you set for the page it will automatically be marked active and you won&#039;t need this call.&lt;br /&gt;
&lt;br /&gt;
Next extending the navigation for the course.&lt;br /&gt;
For this you will need to know the course id and have called require_login($courseorid); so that the navigation is loaded for the course.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$coursenode = $PAGE-&amp;gt;navigation-&amp;gt;find($courseid, navigation_node::TYPE_COURSE);&lt;br /&gt;
$thingnode = $coursenode-&amp;gt;add(get_string(&#039;Name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The new bit of code here really is the first line which simply finds the course node, to do this we give it the course id and the node type in this case TYPE_COURSE.&lt;br /&gt;
What we are doing here is relying on the navigation to generate the navigation up to the course and then just adding to the course.&lt;br /&gt;
&lt;br /&gt;
Note that Moodle loads plugins in alphabetical order. Therefore plugin_b can find a node added by plugin_a but not the other way around.&lt;br /&gt;
====Settings navigation====&lt;br /&gt;
Adding to the settings navigation is very similar to navigation&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$settingnode = $PAGE-&amp;gt;settingsnav-&amp;gt;add(get_string(&#039;setting&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;), navigation_node::TYPE_CONTAINER);&lt;br /&gt;
$thingnode = $settingnode-&amp;gt;add(get_string(&#039;Name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Add Settings folder to navigation====&lt;br /&gt;
&lt;br /&gt;
An example of a settings folder in a module can be see by navigating to Site administration / Plugins / Activity modules / Assignment. &lt;br /&gt;
&lt;br /&gt;
[[File:assignmentmenu.png]]&lt;br /&gt;
&lt;br /&gt;
An example of adding a navigation folder to a settings.php for a block with a link to the settings page and a external page is bellow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
defined(&#039;MOODLE_INTERNAL&#039;) || die;&lt;br /&gt;
&lt;br /&gt;
// Create folder / submenu in block menu, modsettings for activity modules, localplugins for Local plugins. &lt;br /&gt;
// The default folders are defined in admin/settings/plugins.php.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksettings&#039;, new admin_category(&#039;blocksamplefolder&#039;,&lt;br /&gt;
        get_string(&#039;pluginname&#039;, &#039;mod_sample&#039;)));&lt;br /&gt;
&lt;br /&gt;
// Create settings block.&lt;br /&gt;
$settings = new admin_settingpage($section, get_string(&#039;settings&#039;, &#039;block_sample&#039;));&lt;br /&gt;
if ($ADMIN-&amp;gt;fulltree) {&lt;br /&gt;
    $settings-&amp;gt;add(new admin_setting_configcheckbox(&#039;block_sample_checkbox&#039;, get_string(&#039;checkbox&#039;, &#039;block_sample&#039;),&lt;br /&gt;
        get_string(&#039;checkboxdescription&#039;, &#039;block_kronoshtml&#039;), 0));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// This adds the settings link to the folder/submenu.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksamplefolder&#039;, $settings);&lt;br /&gt;
// This adds a link to an external page.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksamplefolder&#039;, new admin_externalpage(&#039;block_sample_page&#039;, get_string(&#039;externalpage&#039;, &#039;block_sample&#039;),&lt;br /&gt;
        $CFG-&amp;gt;wwwroot.&#039;/blocks/sample/sample.php&#039;));&lt;br /&gt;
// Prevent Moodle from adding settings block in standard location.&lt;br /&gt;
$settings = null;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Navbar====&lt;br /&gt;
This is extending the settings navigation.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;ignore_active();&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;add(get_string(&#039;preview&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;add(get_string(&#039;name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above code tells the navbar to ignore what ever the active page was and just use what you add, at which point we add two items as shown.&lt;br /&gt;
===Plugin Callbacks===&lt;br /&gt;
These are specific functions that the navigation looks for and calls if they exist for the plugin, presently only three plugin types can extend the navigation through these call-backs.&lt;br /&gt;
&lt;br /&gt;
Ideally all entries in &amp;quot;Administration / Site administration&amp;quot; tree should be done via settings.php files but sometimes it may be easier to directly modify the navigation structure created from the admin settings tree (such as when adding links to external pages).&lt;br /&gt;
&lt;br /&gt;
====Module====&lt;br /&gt;
Modules have two call-back methods, first to extend the navigation, and second to extend the settings. These call-backs get called when ever the user is viewing a page within the module and should only extend the navigation for the module.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function {modulename}_extend_navigation(${modulename}node, $course, $module, $cm)&lt;br /&gt;
function {modulename}_extend_settings_navigation($settings, ${modulename}node)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Course Formats====&lt;br /&gt;
Course formats are able to completely redefine the way in which navigation is generated for a course, as well as this they also have several methods to ensure the navigation is generated correctly.&lt;br /&gt;
&lt;br /&gt;
====Course Reports====&lt;br /&gt;
By default reports don&#039;t add themselves or anything else to the navigation however there is a call-back that can be implemented to allow them to do so.&lt;br /&gt;
&lt;br /&gt;
====Local Plugins====&lt;br /&gt;
{{Moodle 2.9}}Local plugins have two call-back methods, first to extend the navigation, and second to extend the settings.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_{pluginname}_extend_navigation(global_navigation $nav)&lt;br /&gt;
function local_{pluginname}_extend_settings_navigation(settings_navigation $nav, context $context)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In versions before Moodle 2.9, the supported callbacks have &amp;lt;tt&amp;gt;_extends_&amp;lt;/tt&amp;gt; (not imperative mood) in their names. This was a consistency bug fixed in MDL-49643.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_{pluginname}_extends_navigation(global_navigation $nav)&lt;br /&gt;
function local_{pluginname}_extends_settings_navigation(settings_navigation $nav, context $context)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Course settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the course settings navigation. Prior to 3.0 only &#039;&#039;reports&#039;&#039; and &#039;&#039;admin tools&#039;&#039; could extend the course settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_course(navigation_node $parentnode, stdClass $course, context_course $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====User settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the user settings navigation. Prior to 3.0 only &#039;&#039;admin tools&#039;&#039; could extend the user settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_user_settings(navigation_node $parentnode, stdClass $user, context_user $context, stdClass $course, context_course $coursecontext);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Category settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the category settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_category_settings(navigation_node $parentnode, context_coursecat $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Frontpage settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the frontpage settings navigation. Prior to 3.0 only &#039;&#039;admin tools&#039;&#039; could extend the frontpage settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_frontpage(navigation_node $parentnode, stdClass $course, context_course $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====User profile====&lt;br /&gt;
{{Moodle 3.1}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the user profile navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_user(navigation_node $parentnode, stdClass $user, context_user $context, stdClass $course, context_course $coursecontext);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FAQ&#039;s and troubleshooting==&lt;br /&gt;
&#039;&#039;&#039;Q.&#039;&#039;&#039; My page is on the navigation but it doesn&#039;t find it?&lt;br /&gt;
&lt;br /&gt;
The first thing to do here is check the URL you are setting for the page. It should match the URL your page has within the navigation. If it doesn&#039;t you have two options, first change your &#039;&#039;&#039;$PAGE-&amp;gt;set_url&#039;&#039;&#039; call, or second override the URL the navigation is using to find the active node as shown below:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
navigation_node::override_active_url(new moodle_url(&#039;/your/url/here.php&#039;, array(&#039;param&#039;=&amp;gt;&#039;value&#039;)));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Core APIs]]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=170325&amp;amp;parent=753095 Forum discussion - adding navigation to local plugins]&lt;br /&gt;
&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Gaudreaj</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Navigation_API&amp;diff=50279</id>
		<title>Navigation API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Navigation_API&amp;diff=50279"/>
		<updated>2016-05-24T19:16:24Z</updated>

		<summary type="html">&lt;p&gt;Gaudreaj: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
The Navigation API allows for the manipulation of the navigation system used in Moodle.&lt;br /&gt;
&lt;br /&gt;
==What the navigation is==&lt;br /&gt;
It&#039;s very important to understand what the navigation is exactly within Moodle. One of the goals for Moodle 2.0 was to standardise navigation throughout Moodle and try to bring order to the structure of a Moodle site.  Navigation is available through the page object &#039;&#039;&#039;$PAGE&#039;&#039;&#039;, against which you set the heading for the page, the title, any JavaScript requirements, etc.  The navigation structure uses the information $PAGE contains to generate a navigation structure for the site.  The navigation or settings [[blocks]] are interpretations of the navigation structure Moodle creates.&lt;br /&gt;
&lt;br /&gt;
This navigation structure is available through three variables:&lt;br /&gt;
&lt;br /&gt;
; $PAGE-&amp;gt;navigation : This is the main navigation structure, it will contain items that will allow the user to browse to the other available pages.&lt;br /&gt;
; $PAGE-&amp;gt;settingsnav : This is the settings navigation structure contains items that will allow the user to edit settings.&lt;br /&gt;
; $PAGE-&amp;gt;navbar : The navbar is a special structure for page breadcrumbs.&lt;br /&gt;
&lt;br /&gt;
==What the navigation is not==&lt;br /&gt;
The navigation is &#039;&#039;&#039;NOT&#039;&#039;&#039; the navigation block or the settings block!  These two blocks were created to display the navigation structure. The navigation block looks at &#039;&#039;$PAGE-&amp;gt;navigation&#039;&#039;, and the settings block looks at &#039;&#039;$PAGE-&amp;gt;settingsnav&#039;&#039;.  Both blocks interpret their data into an HTML structure and render it.&lt;br /&gt;
&lt;br /&gt;
# The navigation is a back-end structure that is built behind the scenes and has no immediate method of display.&lt;br /&gt;
# The navigation and settings blocks display the back-end navigation structure but add nothing to it at all.&lt;br /&gt;
::In the [[model-view-controller pattern]], $PAGE-&amp;gt;navigation, $PAGE-&amp;gt;settingsnav, and $PAGE-&amp;gt;navbar are the models, and the blocks are views.&lt;br /&gt;
&lt;br /&gt;
The navbar is just the path to the active navigation or settings item. The navbar is not displayed by a block; instead it is added into the theme&#039;s layout files and displayed by the core renderer. &lt;br /&gt;
&lt;br /&gt;
==How the navigation works==&lt;br /&gt;
&lt;br /&gt;
The main navigation structure can be accessed through &#039;&#039;&#039;$PAGE-&amp;gt;navigation&#039;&#039;&#039;.  The navigation and settings are contextual in that they will relate to the page that the user is viewing. This is determined by other $PAGE object properties:&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;context&#039;&#039;&#039; is a Moodle context that immediately outlines the nature of the page the user is viewing.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;course&#039;&#039;&#039; is the course the user is viewing.  This is essential if the context is CONTEXT_COURSE or greater.  However, it is also useful in other contexts such as CONTEXT_USER.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;cm&#039;&#039;&#039; is the course module instance.  This is essential if the context is CONTEXT_MODULE or greater.&lt;br /&gt;
* &#039;&#039;&#039;$PAGE-&amp;gt;url&#039;&#039;&#039; is used to match the active navigation item. &lt;br /&gt;
&lt;br /&gt;
Nearly every page sets $PAGE-&amp;gt;url through a call to &#039;&#039;&#039;$PAGE-&amp;gt;set_url&#039;&#039;&#039; however not many explicitly set the context, course, or cm. When you call &#039;&#039;&#039;require_login&#039;&#039;&#039; with a course or cm it automatically calls the following:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
if ($cm) {&lt;br /&gt;
    $PAGE-&amp;gt;set_cm($cm, $course); // sets up global $COURSE&lt;br /&gt;
} else {&lt;br /&gt;
    $PAGE-&amp;gt;set_course($course);// sets up global $COURSE&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A page will only be required to explicitly set a context, course, or cm under one of these conditions:&lt;br /&gt;
# &#039;&#039;&#039;require_login&#039;&#039;&#039; is NOT being called correctly&lt;br /&gt;
# The page is using CONTEXT_SYSTEM, CONTEXT_COURSECAT, or CONTEXT_USER (call &#039;&#039;&#039;$PAGE-&amp;gt;set_context&#039;&#039;&#039; ).&lt;br /&gt;
# The page is using a course or cm but it is also using one of the above contexts (call &#039;&#039;&#039;$PAGE-&amp;gt;set_course&#039;&#039;&#039; or &#039;&#039;&#039;$PAGE-&amp;gt;set_cm&#039;&#039;&#039; ).&lt;br /&gt;
&lt;br /&gt;
The navigation structure cannot be generated before the $PAGE object is configured. It is only generated when it is first used, either when something tries to access the structure or when code tries to add to it.  The navigation is initialised in a specific order:&lt;br /&gt;
# Main navigation structure&lt;br /&gt;
# Settings navigation&lt;br /&gt;
# Navbar (does not need to be generated because of its simple contents and rendering)&lt;br /&gt;
&lt;br /&gt;
==Extending the navigation==&lt;br /&gt;
&lt;br /&gt;
===Code extension===&lt;br /&gt;
This method of extending is when the code arbitrarily extends the navigation during its execution. Extending the navigation through this means allows you to extend the navigation anywhere easily, however it will only be shown on pages where your extending code gets called (you should probably put it in a function within lib.php).&lt;br /&gt;
&lt;br /&gt;
These examples are taken from the [http://moodle.org/mod/forum/discuss.php?d=152391 General Developer Forum: Moodle 2 - how to set up breadcrumbs for a module page]. It has further information that is well worth reading.&lt;br /&gt;
====Navigation====&lt;br /&gt;
This is extending the main navigation structure.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$previewnode = $PAGE-&amp;gt;navigation-&amp;gt;add(get_string(&#039;preview&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;), navigation_node::TYPE_CONTAINER);&lt;br /&gt;
$thingnode = $previewnode-&amp;gt;add(get_string(&#039;name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above lines of code adds a preview node to the bottom of the navigation and then adds a thingnode to the previewnode (adding a leaf to our tree).&lt;br /&gt;
The final line of code makes the thingnode active so that the navbar finds it however if the URL you give it is the same as the url you set for the page it will automatically be marked active and you won&#039;t need this call.&lt;br /&gt;
&lt;br /&gt;
Next extending the navigation for the course.&lt;br /&gt;
For this you will need to know the course id and have called require_login($courseorid); so that the navigation is loaded for the course.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$coursenode = $PAGE-&amp;gt;navigation-&amp;gt;find($courseid, navigation_node::TYPE_COURSE);&lt;br /&gt;
$thingnode = $coursenode-&amp;gt;add(get_string(&#039;Name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The new bit of code here really is the first line which simply finds the course node, to do this we give it the course id and the node type in this case TYPE_COURSE.&lt;br /&gt;
What we are doing here is relying on the navigation to generate the navigation up to the course and then just adding to the course.&lt;br /&gt;
&lt;br /&gt;
Note that Moodle loads plugins in alphabetical order. Therefore plugin_b can find a node added by plugin_a but not the other way around.&lt;br /&gt;
====Settings navigation====&lt;br /&gt;
Adding to the settings navigation is very similar to navigation&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$settingnode = $PAGE-&amp;gt;settingsnav-&amp;gt;add(get_string(&#039;setting&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;), navigation_node::TYPE_CONTAINER);&lt;br /&gt;
$thingnode = $settingnode-&amp;gt;add(get_string(&#039;Name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$thingnode-&amp;gt;make_active();&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Add Settings folder to navigation====&lt;br /&gt;
&lt;br /&gt;
An example of a settings folder in a module can be see by navigating to Site administration / Plugins / Activity modules / Assignment. &lt;br /&gt;
&lt;br /&gt;
[[File:assignmentmenu.png]]&lt;br /&gt;
&lt;br /&gt;
An example of adding a navigation folder to a settings.php for a block with a link to the settings page and a external page is bellow.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
defined(&#039;MOODLE_INTERNAL&#039;) || die;&lt;br /&gt;
&lt;br /&gt;
// Create folder / submenu in block menu, modsettings for activity modules, localplugins for Local plugins. &lt;br /&gt;
// The default folders are defined in admin/settings/plugins.php.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksettings&#039;, new admin_category(&#039;blocksamplefolder&#039;,&lt;br /&gt;
        get_string(&#039;pluginname&#039;, &#039;mod_sample&#039;)));&lt;br /&gt;
&lt;br /&gt;
// Create settings block.&lt;br /&gt;
$settings = new admin_settingpage($section, get_string(&#039;settings&#039;, &#039;block_sample&#039;));&lt;br /&gt;
if ($ADMIN-&amp;gt;fulltree) {&lt;br /&gt;
    $settings-&amp;gt;add(new admin_setting_configcheckbox(&#039;block_sample_checkbox&#039;, get_string(&#039;checkbox&#039;, &#039;block_sample&#039;),&lt;br /&gt;
        get_string(&#039;checkboxdescription&#039;, &#039;block_kronoshtml&#039;), 0));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// This adds the settings link to the folder/submenu.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksamplefolder&#039;, $settings);&lt;br /&gt;
// This adds a link to an external page.&lt;br /&gt;
$ADMIN-&amp;gt;add(&#039;blocksamplefolder&#039;, new admin_externalpage(&#039;block_sample_page&#039;, get_string(&#039;externalpage&#039;, &#039;block_sample&#039;),&lt;br /&gt;
        $CFG-&amp;gt;wwwroot.&#039;/blocks/sample/sample.php&#039;));&lt;br /&gt;
// Prevent Moodle from adding settings block in standard location.&lt;br /&gt;
$settings = null;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Navbar====&lt;br /&gt;
This is extending the settings navigation.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;ignore_active();&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;add(get_string(&#039;preview&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
$PAGE-&amp;gt;navbar-&amp;gt;add(get_string(&#039;name of thing&#039;), new moodle_url(&#039;/a/link/if/you/want/one.php&#039;));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The above code tells the navbar to ignore what ever the active page was and just use what you add, at which point we add two items as shown.&lt;br /&gt;
===Plugin Callbacks===&lt;br /&gt;
These are specific functions that the navigation looks for and calls if they exist for the plugin, presently only three plugin types can extend the navigation through these call-backs.&lt;br /&gt;
&lt;br /&gt;
Ideally all entries in &amp;quot;Administration / Site administration&amp;quot; tree should be done via settings.php files but sometimes it may be easier to directly modify the navigation structure created from the admin settings tree (such as when adding links to external pages).&lt;br /&gt;
&lt;br /&gt;
====Module====&lt;br /&gt;
Modules have two call-back methods, first to extend the navigation, and second to extend the settings. These call-backs get called when ever the user is viewing a page within the module and should only extend the navigation for the module.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function {modulename}_extend_navigation(${modulename}node, $course, $module, $cm)&lt;br /&gt;
function {modulename}_extend_settings_navigation($settings, ${modulename}node)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Course Formats====&lt;br /&gt;
Course formats are able to completely redefine the way in which navigation is generated for a course, as well as this they also have several methods to ensure the navigation is generated correctly.&lt;br /&gt;
&lt;br /&gt;
====Course Reports====&lt;br /&gt;
By default reports don&#039;t add themselves or anything else to the navigation however there is a call-back that can be implemented to allow them to do so.&lt;br /&gt;
&lt;br /&gt;
====Local Plugins====&lt;br /&gt;
{{Moodle 2.9}}Local plugins have two call-back methods, first to extend the navigation, and second to extend the settings.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_{pluginname}_extend_navigation(global_navigation $nav)&lt;br /&gt;
function local_{pluginname}_extend_settings_navigation(settings_navigation $nav, context $context)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In versions before Moodle 2.9, the supported callbacks have &amp;lt;tt&amp;gt;_extends_&amp;lt;/tt&amp;gt; (not imperative mood) in their names. This was a consistency bug fixed in MDL-49643.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function local_{pluginname}_extends_navigation(global_navigation $nav)&lt;br /&gt;
function local_{pluginname}_extends_settings_navigation(settings_navigation $nav, context $context)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Course settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the course settings navigation. Prior to 3.0 only &#039;&#039;reports&#039;&#039; and &#039;&#039;admin tools&#039;&#039; could extend the course settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_course(navigation_node $parentnode, stdClass $course, context_course $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====User settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the user settings navigation. Prior to 3.0 only &#039;&#039;admin tools&#039;&#039; could extend the user settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_user_settings(navigation_node $parentnode, stdClass $user, context_user $context, stdClass $course, context_course $coursecontext);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Category settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the category settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_category_settings(navigation_node $parentnode, context_coursecat $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Frontpage settings====&lt;br /&gt;
{{Moodle 3.0}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the frontpage settings navigation. Prior to 3.0 only &#039;&#039;admin tools&#039;&#039; could extend the frontpage settings navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_frontpage(navigation_node $parentnode, stdClass $course, context_course $context);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====User Profile====&lt;br /&gt;
{{Moodle 3.1}}&lt;br /&gt;
Any plugin implementing the following callback in lib.php can extend the user profile navigation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
function &amp;lt;component&amp;gt;_extend_navigation_user(navigation_node $parentnode, stdClass $user, context_user $context, stdClass $course, context_course $coursecontext);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==FAQ&#039;s and troubleshooting==&lt;br /&gt;
&#039;&#039;&#039;Q.&#039;&#039;&#039; My page is on the navigation but it doesn&#039;t find it?&lt;br /&gt;
&lt;br /&gt;
The first thing to do here is check the URL you are setting for the page. It should match the URL your page has within the navigation. If it doesn&#039;t you have two options, first change your &#039;&#039;&#039;$PAGE-&amp;gt;set_url&#039;&#039;&#039; call, or second override the URL the navigation is using to find the active node as shown below:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
navigation_node::override_active_url(new moodle_url(&#039;/your/url/here.php&#039;, array(&#039;param&#039;=&amp;gt;&#039;value&#039;)));&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Core APIs]]&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=170325&amp;amp;parent=753095 Forum discussion - adding navigation to local plugins]&lt;br /&gt;
&lt;br /&gt;
[[Category:API]]&lt;/div&gt;</summary>
		<author><name>Gaudreaj</name></author>
	</entry>
</feed>