Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401]

(no description)

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

Defines 1 class


Class: boostnavbar  - X-Ref

Creates a navbar for boost that allows easy control of the navbar items.

__construct(\moodle_page $page)   X-Ref
Takes a navbar object and picks the necessary parts for display.

param: \moodle_page $page The current moodle page.

prepare_nodes_for_boost()   X-Ref
Prepares the navigation nodes for use with boost.


get_items()   X-Ref
Get all the boostnavbaritem elements.

return: boostnavbaritem[] Boost navbar items.

clear_items()   X-Ref
Removes all navigation items out of this boost navbar


get_item($key)   X-Ref
Retrieve a single navbar item.

param: string|int $key The identifier of the navbar item to return.
return: \breadcrumb_navigation_node|null The navbar item.

item_count()   X-Ref
Counts all of the navbar items.

return: int How many navbar items there are.

remove($itemkey, ?int $itemtype = null)   X-Ref
Remove a boostnavbaritem from the boost navbar.

param: string|int $itemkey An identifier for the boostnavbaritem
param: int|null $itemtype An additional type identifier for the boostnavbaritem (optional)

remove_last_item_action()   X-Ref
Removes the action from the last item of the boostnavbaritem.


get_penultimate_item()   X-Ref
Returns the second last navbar item. This is for use in the mobile view where we are showing just the second
last item in the breadcrumb navbar.

return: breakcrumb_navigation_node|null The second last navigation node.

remove_no_link_items(bool $removesections = true)   X-Ref
Remove items that have no actions associated with them and optionally remove items that are sections.

The only exception is the last item in the list which may not have a link but needs to be displayed.

param: bool $removesections Whether section items should be also removed (only applies when they have an action)

remove_items_that_exist_in_navigation(view $navigationview)   X-Ref
Remove breadcrumb items that already exist in a given navigation view.

This method removes the breadcrumb items that have a text => action match in a given navigation view
(primary or secondary).

param: view $navigationview The navigation view object.

remove_duplicate_items()   X-Ref
Remove duplicate breadcrumb items.

This method looks for breadcrumb items that have identical text and action values and removes the first item.

get_node_text_and_action(navigation_node $node)   X-Ref
Helper function that returns an array of the text and the outputted action url (if exists) for a given
navigation node.

param: navigation_node $node The navigation node object.
return: array