class MenuSet

Our class to capture a set of top menus

A top menu looks like

Home Left Left        Right Right

Properties

$home The Home Menu
$left The Left Menu
$right The Right Menu

Methods

setHome($link, $href)

Set the Home Menu

addLeft($link, $href, $push = false, $attr = false)

Add an entty to the Left Menu

addRight($link, $href, $push = true, $attr = false)

Add an entty to the Right Menu

string
export($pretty = false)

Export a menu to JSON

static The
import($json_str)

Import a menu from JSON

Details

at line 39
MenuSet setHome($link, $href)

Set the Home Menu

Parameters

$link The text of the link - can be text, HTML, or even an img tag
$href An optional place to go when the link is clicked

Return Value

MenuSet The instance to allow for chaining

at line 55
MenuSet addLeft($link, $href, $push = false, $attr = false)

Add an entty to the Left Menu

Parameters

$link The text of the link - can be text, HTML, or even an img tag
$href An optional place to go when the link is clicked
$push Indicates to push down the other menu entries
$attr An optional string to add within the anchor tag

Return Value

MenuSet The instance to allow for chaining

at line 73
MenuSet addRight($link, $href, $push = true, $attr = false)

Add an entty to the Right Menu

Parameters

$link The text of the link - can be text, HTML, or even an img tag
$href An optional place to go when the link is clicked
$push Indicates to push down the other menu entries
$attr An optional string to add within the anchor tag

Return Value

MenuSet The instance to allow for chaining

at line 88
string export($pretty = false)

Export a menu to JSON

Parameters

$pretty
  • True if we want pretty output

Return Value

string JSON string for the menu

at line 108
static The import($json_str)

Import a menu from JSON

Parameters

$json_str The menu as exported

Return Value

The MenuSet as parsed or false on error