Navigation
in package
Provides navigation functions
Table of Contents
Properties
- $page_node_matcher : TreenodeMatcher|null
- $pmm2_nav_id : int
- $root_node : Pagenode|null
Methods
- banner() : mixed
- Returns the filename to use for a banner image, or NULL if no appropriate banner was found
- breadcrumb() : string
- Renders breadcrumbs for the current page
- buildBrowserTitle() : mixed
- Builds the title that gets put into TITLE tags in the head of the page Just glues the site title onto the end of the page title
- clearCache() : mixed
- Nuke the navigation from the cache.
- currentReveal() : mixed
- Draws a current-reveal menu.
- customBreadcrumb() : string
- Renders a custom breadcrumb based on an array of crumbs.
- getAllPages() : mixed
- Returns an array of all pages.
- getCrumbs() : array<string|int, mixed>
- getMatchedNode() : mixed
- Alias for {@see Navigation::matchedNode}()
- getMenuItems() : Pagenode|null
- Returns the filtered menu items for use in custom twig navigation templates
- getPageNodeMatcher() : TreenodeMatcher
- Gets the matcher that is used to get the current page
- getRootNode() : mixed
- Gets the root node of the currently loaded navigation tree
- loadPageTree() : Pagenode
- Loads the page tree from the database
- matchedNode() : Treenode|null
- Finds the node in the page tree which matched the specified {@see TreenodeMatcher}.
- nonDropdown() : mixed
- Generates a menu which does not have dropdowns, but just has the top-level items
- pmm2() : mixed
- Draws a pmm2 menu, with the current page highlighted in the menu
- renderCrumbs() : string
- Renders a custom breadcrumb based on an array of crumbs
- rootNode() : mixed
- Alias for Navigation::getRootNode()
- sectionName() : mixed
- Returns the name of this section, or the site name if no reasonable section can be determined.
- setPageNodeMatcher() : mixed
- Sets a matcher that should be used to find the current page in the tree
- simpleMenu() : void
- Returns a simple menu
- superfish() : mixed
- Draws a superfish menu, with the current page highlighted in the menu
- zippmenuChildren() : mixed
- Draws a UL of children for a zippmenu
- currentRevealDrawnode() : mixed
- Draws a single item, and its sub-items
- pmm2Drawnode() : mixed
- Draws a single item, and its sub-items
- simpleMenuDrawnode() : mixed
- Private node drawing function for SuperFish menu.
- superfishDrawnode() : mixed
- Private node drawing function for SuperFish menu.
Properties
$page_node_matcher
private
static TreenodeMatcher|null
$page_node_matcher
= null
$pmm2_nav_id
private
static int
$pmm2_nav_id
= 0
$root_node
private
static Pagenode|null
$root_node
= null
Methods
banner()
Returns the filename to use for a banner image, or NULL if no appropriate banner was found
public
static banner() : mixed
breadcrumb()
Renders breadcrumbs for the current page
public
static breadcrumb([string $seperator_front = ' » ' ][, array<string|int, mixed> $post_crumbs = null ][, string $seperator_back = '' ]) : string
Parameters
- $seperator_front : string = ' » '
-
The separator to use. Defaults to ' >> '
- $post_crumbs : array<string|int, mixed> = null
-
Additional crumbs to add after the navigation ones. Should be in the format url => label
- $seperator_back : string = ''
-
The separator for the closing tag, if needed.
Return values
string —HTML
buildBrowserTitle()
Builds the title that gets put into TITLE tags in the head of the page Just glues the site title onto the end of the page title
public
static buildBrowserTitle(string $page_title) : mixed
Parameters
- $page_title : string
-
The title of the page
clearCache()
Nuke the navigation from the cache.
public
static clearCache() : mixed
Assumes the user is logged into the admin
currentReveal()
Draws a current-reveal menu.
public
static currentReveal() : mixed
This is a menu where the top level items all get shown, but the children only get shown for active items.
Uses the same HTML as the pmm2 menu, just because that HTML has plenty of classes and ids, and I already had the code for that menu :)
See http://www.rymill.com.au/ for an example of this type of menu.
Tags
customBreadcrumb()
Renders a custom breadcrumb based on an array of crumbs.
public
static customBreadcrumb(array<string|int, mixed> $crumbs[, string $seperator_front = ' » ' ][, string $seperator_back = '' ]) : string
This includes a home tag.
Parameters
- $crumbs : array<string|int, mixed>
-
Crumbs for the breadcrumb. Should be in the format url => label
- $seperator_front : string = ' » '
-
The separator to use. Defaults to ' >> '
- $seperator_back : string = ''
-
The separator for the closing tag, if needed.
Return values
string —HTML
getAllPages()
Returns an array of all pages.
public
static getAllPages([mixed $parent = null ][, mixed $indent = 0 ]) : mixed
Parameters
- $parent : mixed = null
- $indent : mixed = 0
getCrumbs()
public
static getCrumbs([array<string|int, mixed>|null $post_crumbs = null ]) : array<string|int, mixed>
Parameters
- $post_crumbs : array<string|int, mixed>|null = null
Return values
array<string|int, mixed> —[ url, label ]
getMatchedNode()
Alias for {@see Navigation::matchedNode}()
public
static getMatchedNode() : mixed
getMenuItems()
Returns the filtered menu items for use in custom twig navigation templates
public
static getMenuItems() : Pagenode|null
Return values
Pagenode|nullgetPageNodeMatcher()
Gets the matcher that is used to get the current page
public
static getPageNodeMatcher() : TreenodeMatcher
Return values
TreenodeMatcher —The matcher being used.
getRootNode()
Gets the root node of the currently loaded navigation tree
public
static getRootNode() : mixed
loadPageTree()
Loads the page tree from the database
public
static loadPageTree([int $subsite_id = null ][, bool $is_admin = false ][, bool $set_root = true ]) : Pagenode
Parameters
- $subsite_id : int = null
-
The subsite to load pages from. If not provided, the current subsite is assumed.
- $is_admin : bool = false
-
If the user is in the admin, certain restrictions are not enforced.
- $set_root : bool = true
-
Set the Navigation::$root_node paramater, as used by all the other methods. Default is to set this parameter, but if you want the tree loaded twice for some reason, set to false.
Return values
Pagenode —The root node of the tree
matchedNode()
Finds the node in the page tree which matched the specified {@see TreenodeMatcher}.
public
static matchedNode() : Treenode|null
Return values
Treenode|null —null if no node is found, or if the matcher does not exist
nonDropdown()
Generates a menu which does not have dropdowns, but just has the top-level items
public
static nonDropdown() : mixed
Tags
pmm2()
Draws a pmm2 menu, with the current page highlighted in the menu
public
static pmm2() : mixed
Tags
renderCrumbs()
Renders a custom breadcrumb based on an array of crumbs
public
static renderCrumbs(array<string|int, mixed> $crumbs[, string $seperator_front = ' » ' ][, string $seperator_back = '' ]) : string
Parameters
- $crumbs : array<string|int, mixed>
-
Crumbs for the breadcrumb. Should be in the format url => label
- $seperator_front : string = ' » '
-
The separator to use. Defaults to ' >> '
- $seperator_back : string = ''
-
The separator for the closing tag, if needed.
Return values
string —HTML
rootNode()
Alias for Navigation::getRootNode()
public
static rootNode() : mixed
sectionName()
Returns the name of this section, or the site name if no reasonable section can be determined.
public
static sectionName() : mixed
setPageNodeMatcher()
Sets a matcher that should be used to find the current page in the tree
public
static setPageNodeMatcher(TreenodeMatcher $page_node_matcher) : mixed
Parameters
- $page_node_matcher : TreenodeMatcher
-
The matcher to use
simpleMenu()
Returns a simple menu
public
static simpleMenu() : void
Return values
void —Outputs HTML directly
superfish()
Draws a superfish menu, with the current page highlighted in the menu
public
static superfish() : mixed
zippmenuChildren()
Draws a UL of children for a zippmenu
public
static zippmenuChildren(mixed $page_url) : mixed
Parameters
- $page_url : mixed
currentRevealDrawnode()
Draws a single item, and its sub-items
private
static currentRevealDrawnode(Pagenode $node, int $depth) : mixed
Parameters
- $node : Pagenode
-
The node to draw
- $depth : int
-
The current depth of the tree
pmm2Drawnode()
Draws a single item, and its sub-items
private
static pmm2Drawnode(Pagenode $node, int $depth, mixed $pmm_max_depth, mixed $pmm_nav_limit) : mixed
Parameters
- $node : Pagenode
-
The node to draw
- $depth : int
-
The current depth of the tree
- $pmm_max_depth : mixed
- $pmm_nav_limit : mixed
simpleMenuDrawnode()
Private node drawing function for SuperFish menu.
private
static simpleMenuDrawnode(mixed $node, mixed $depth, mixed $pmm_max_depth) : mixed
Parameters
- $node : mixed
- $depth : mixed
- $pmm_max_depth : mixed
superfishDrawnode()
Private node drawing function for SuperFish menu.
private
static superfishDrawnode(mixed $node, mixed $depth, mixed $pmm_max_depth) : mixed
Parameters
- $node : mixed
- $depth : mixed
- $pmm_max_depth : mixed