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: 153 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

view:: (4 methods):
  __construct()
  get_leaf_nodes()
  scan_for_active_node()
  active_node_scan()


Class: view  - X-Ref

Class view.

The base view class which expands on the navigation_node,

__construct(\moodle_page $page)   X-Ref
navigation constructor.

param: \moodle_page $page

get_leaf_nodes(navigation_node $source, array $nodes)   X-Ref
Get the leaf nodes for the nav view

return: array $nodesordered The fetched nodes ordered based on final specification.
param: navigation_node $source The settingsnav OR navigation object
param: array $nodes An array of nodes to fetch from the source which specifies the node type and final order

scan_for_active_node(navigation_node $node)   X-Ref
Scan the given node for the active node. It starts first with a strict search and then switches to a base search if
required.

return: navigation_node|null The active node or null.
param: navigation_node $node The node to scan.

active_node_scan(navigation_node $node,int $strictness = URL_MATCH_EXACT)   X-Ref
This function recursively scans nodes until it finds the active node or there
are no more nodes. We are using a custom implementation here to adjust the strictness
and also because we need the parent node and not the specific child node in the new views.
e.g. Structure for site admin,
SecondaryNav
- Site Admin
- Users
- User policies
- Courses
In the above example, if we are on the 'User Policies' page, the active node should be 'Users'

return: navigation_node|null
param: navigation_node $node
param: int $strictness How stict to be with the scan for the active node.