MenuSet
in package
Our class to capture a set of top menus
A top menu looks like
Home Left Left Right Right
Table of Contents
Properties
Methods
- addLeft() : MenuSet
- Add an entty to the Left Menu
- addRight() : MenuSet
- Add an entty to the Right Menu
- export() : string
- Export a menu to JSON
- import() : The
- Import a menu from JSON
- setHome() : MenuSet
- Set the Home Menu
- importRecurse() : mixed
- Walk a JSON tree to import a hierarchy of menus
Properties
$home
The Home Menu
public
mixed
$home
= false
$left
The Left Menu
public
mixed
$left
= false
$right
The Right Menu
public
mixed
$right
= false
Methods
addLeft()
Add an entty to the Left Menu
public
addLeft(mixed $link, mixed $href[, mixed $push = false ][, mixed $attr = false ]) : MenuSet
Parameters
- $link : mixed
-
The text of the link - can be text, HTML, or even an img tag
- $href : mixed
-
An optional place to go when the link is clicked
- $push : mixed = false
-
Indicates to push down the other menu entries
- $attr : mixed = false
-
An optional string to add within the anchor tag
Return values
MenuSet —The instance to allow for chaining
addRight()
Add an entty to the Right Menu
public
addRight(mixed $link, mixed $href[, mixed $push = true ][, mixed $attr = false ]) : MenuSet
Parameters
- $link : mixed
-
The text of the link - can be text, HTML, or even an img tag
- $href : mixed
-
An optional place to go when the link is clicked
- $push : mixed = true
-
Indicates to push down the other menu entries
- $attr : mixed = false
-
An optional string to add within the anchor tag
Return values
MenuSet —The instance to allow for chaining
export()
Export a menu to JSON
public
export([mixed $pretty = false ]) : string
Parameters
- $pretty : mixed = false
-
- True if we want pretty output
Return values
string —JSON string for the menu
import()
Import a menu from JSON
public
static import(mixed $json_str) : The
Parameters
- $json_str : mixed
-
The menu as exported
Return values
The —MenuSet as parsed or false on error
setHome()
Set the Home Menu
public
setHome(mixed $link, mixed $href[, mixed $attr = false ]) : MenuSet
Parameters
- $link : mixed
-
The text of the link - can be text, HTML, or even an img tag
- $href : mixed
-
An optional place to go when the link is clicked
- $attr : mixed = false
Return values
MenuSet —The instance to allow for chaining
importRecurse()
Walk a JSON tree to import a hierarchy of menus
private
static importRecurse(mixed $entry, mixed $depth) : mixed
Parameters
- $entry : mixed
- $depth : mixed