Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
theme_boost\boostnavbar Class Reference
Inheritance diagram for theme_boost\boostnavbar:
renderable

Public Member Functions

 __construct (\moodle_page $page)
 Takes a navbar object and picks the necessary parts for display.
 
 get_items ()
 Get all the boostnavbaritem elements.
 
 get_penultimate_item ()
 Returns the second last navbar item.
 

Protected Member Functions

 clear_items ()
 Removes all navigation items out of this boost navbar.
 
 get_item ($key)
 Retrieve a single navbar item.
 
 get_node_text_and_action (navigation_node $node)
 Helper function that returns an array of the text and the outputted action url (if exists) for a given navigation node.
 
 item_count ()
 Counts all of the navbar items.
 
 prepare_nodes_for_boost ()
 Prepares the navigation nodes for use with boost.
 
 remove ($itemkey, ?int $itemtype=null)
 Remove a boostnavbaritem from the boost navbar.
 
 remove_duplicate_items ()
 Remove duplicate breadcrumb items.
 
 remove_items_that_exist_in_navigation (view $navigationview)
 Remove breadcrumb items that already exist in a given navigation view.
 
 remove_last_item_action ()
 Removes the action from the last item of the boostnavbaritem.
 
 remove_no_link_items (bool $removesections=true)
 Remove items that have no actions associated with them and optionally remove items that are sections.
 

Protected Attributes

array $items = []
 The individual items of the navbar.
 
moodle_page $page
 The current moodle page.
 

Constructor & Destructor Documentation

◆ __construct()

theme_boost\boostnavbar::__construct ( \moodle_page $page)

Takes a navbar object and picks the necessary parts for display.

Parameters
moodle_page$pageThe current moodle page.

Member Function Documentation

◆ get_item()

theme_boost\boostnavbar::get_item ( $key)
protected

Retrieve a single navbar item.

Parameters
string | int$keyThe identifier of the navbar item to return.
Return values
breadcrumb_navigation_node|nullThe navbar item.

◆ get_items()

theme_boost\boostnavbar::get_items ( )

Get all the boostnavbaritem elements.

Return values
boostnavbaritem[]Boost navbar items.

◆ get_node_text_and_action()

theme_boost\boostnavbar::get_node_text_and_action ( navigation_node $node)
protected

Helper function that returns an array of the text and the outputted action url (if exists) for a given navigation node.

Parameters
navigation_node$nodeThe navigation node object.
Return values
array

◆ get_penultimate_item()

theme_boost\boostnavbar::get_penultimate_item ( )

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 values
breakcrumb_navigation_node|nullThe second last navigation node.

◆ item_count()

theme_boost\boostnavbar::item_count ( )
protected

Counts all of the navbar items.

Return values
intHow many navbar items there are.

◆ remove()

theme_boost\boostnavbar::remove ( $itemkey,
?int $itemtype = null )
protected

Remove a boostnavbaritem from the boost navbar.

Parameters
string | int$itemkeyAn identifier for the boostnavbaritem
int | null$itemtypeAn additional type identifier for the boostnavbaritem (optional)

◆ remove_duplicate_items()

theme_boost\boostnavbar::remove_duplicate_items ( )
protected

Remove duplicate breadcrumb items.

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

◆ remove_items_that_exist_in_navigation()

theme_boost\boostnavbar::remove_items_that_exist_in_navigation ( view $navigationview)
protected

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).

Parameters
view$navigationviewThe navigation view object.

◆ remove_no_link_items()

theme_boost\boostnavbar::remove_no_link_items ( bool $removesections = true)
protected

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.

Parameters
bool$removesectionsWhether section items should be also removed (only applies when they have an action)

The documentation for this class was generated from the following file: