class SiteMenu extends AbstractMenu

Menu class

Methods

__construct( array $options = array())

Class constructor

static  AbstractMenu
getInstance( string $client, array $options = array())

Returns a Menu object

MenuItem|null
getItem( integer $id)

Get menu item by id

boolean
setDefault( integer $id, string $language = '*')

Set the default item by id and language code.

MenuItem|null
getDefault( string $language = '*')

Get menu item by id

MenuItem|null
setActive( integer $id)

Set the default item by id

MenuItem|null
getActive()

Get menu item by id.

getItems( mixed $attributes, mixed $values, boolean $firstonly = false)

Gets menu items by attribute

Registry
getParams( integer $id)

Gets the parameter object for a certain menu item

getMenu()

Getter for the menu array

boolean
authorise( integer $id)

Method to check Menu object authorization against an access control object and optionally an access extension object

array
load()

Loads the entire menu table into memory.

Details

__construct( array $options = array())

Class constructor

Parameters

array $options An array of configuration options.

static AbstractMenu getInstance( string $client, array $options = array())

Returns a Menu object

Parameters

string $client The name of the client
array $options An associative array of options

Return Value

AbstractMenu A menu object.

Exceptions

Exception

MenuItem|null getItem( integer $id)

Get menu item by id

Parameters

integer $id The item id

Return Value

MenuItem|null The item object if the ID exists or null if not found

boolean setDefault( integer $id, string $language = '*')

Set the default item by id and language code.

Parameters

integer $id The menu item id.
string $language The language code (since 1.6).

Return Value

boolean True if a menu item with the given ID exists

MenuItem|null getDefault( string $language = '*')

Get menu item by id

Parameters

string $language The language code, default value of * means all.

Return Value

MenuItem|null The item object or null when not found for given language

MenuItem|null setActive( integer $id)

Set the default item by id

Parameters

integer $id The item id

Return Value

MenuItem|null The menu item representing the given ID if present or null otherwise

MenuItem|null getActive()

Get menu item by id.

Return Value

MenuItem|null The item object if an active menu item has been set or null

MenuItem|MenuItem[] getItems( mixed $attributes, mixed $values, boolean $firstonly = false)

Gets menu items by attribute

Parameters

mixed $attributes The field name(s).
mixed $values The value(s) of the field. If an array, need to match field names each attribute may have multiple values to lookup for.
boolean $firstonly If true, only returns the first item found

Return Value

MenuItem|MenuItem[] An array of menu item objects or a single object if the $firstonly parameter is true

Registry getParams( integer $id)

Gets the parameter object for a certain menu item

Parameters

integer $id The item id

Return Value

Registry

MenuItem[] getMenu()

Getter for the menu array

Return Value

MenuItem[]

boolean authorise( integer $id)

Method to check Menu object authorization against an access control object and optionally an access extension object

Parameters

integer $id The menu id

Return Value

boolean

array load()

Loads the entire menu table into memory.

Return Value

array