Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 236 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

primary:: (5 methods):
  __construct()
  export_for_template()
  get_primary_nav()
  get_custom_menu()
  get_user_menu()


Class: primary  - X-Ref

Primary navigation renderable

This file combines primary nav, custom menu, lang menu and
usermenu into a standardized format for the frontend

__construct($page)   X-Ref
primary constructor.

param: \moodle_page $page

export_for_template(?renderer_base $output = null)   X-Ref
Combine the various menus into a standardized output.

return: array
param: renderer_base|null $output

get_primary_nav()   X-Ref
Get the primary nav object and standardize the output

return: array

get_custom_menu(renderer_base $output)   X-Ref
Custom menu items reside on the same level as the original nodes.
Fetch and convert the nodes to a standardised array.

return: array
param: renderer_base $output

get_user_menu(renderer_base $output)   X-Ref
Get/Generate the user menu.

This is leveraging the data from user_get_user_navigation_info and the logic in $OUTPUT->user_menu()

return: array
param: renderer_base $output