class Menu (View source)

Class to manage left menus

Properties

array<array{url: string, titre: string, enabled: int<0, 2>, target: string, mainmenu: string, leftmenu: string, position: int, positionfull: int|string, showtopmenuinframe: int, level?: int, id: string, idsel: string, classname: string, prefix?: string}> $liste

List of menu items

Methods

__construct()

Constructor

void
clear()

Clear property ->liste

void
add(string $url, string $titre, int $level = 0, int $enabled = 1, string $target = '', string $mainmenu = '', string $leftmenu = '', int $position = 0, string $id = '', string $idsel = '', string $classname = '', string $prefix = '')

Add a menu entry into this->liste (at end)

void
insert(int $idafter, string $url, string $titre, int $level = 0, int $enabled = 1, string $target = '', string $mainmenu = '', string $leftmenu = '', int $position = 0, string $id = '', string $idsel = '', string $classname = '', string $prefix = '')

Insert a menu entry into this->liste (after $idafter)

void
remove_last()

Remove a menu entry from this->liste

getNbOfVisibleMenuEntries()

Return number of visible entries (gray or not)

Details

__construct()

Constructor

void clear()

Clear property ->liste

Return Value

void

void add(string $url, string $titre, int $level = 0, int $enabled = 1, string $target = '', string $mainmenu = '', string $leftmenu = '', int $position = 0, string $id = '', string $idsel = '', string $classname = '', string $prefix = '')

Add a menu entry into this->liste (at end)

Parameters

string $url

Url to follow on click (does not include DOL_URL_ROOT)

string $titre

Label of menu to add. The value must already be translated.

int $level

Level of menu to add

int $enabled

Menu active or not (0=Not active, 1=Active, 2=Active but grey)

string $target

Target link

string $mainmenu

Main menu ('home', 'companies', 'products', ...)

string $leftmenu

Left menu ('setup', 'system', 'admintools', ...)

int $position

Position (not used yet)

string $id Id
string $idsel

Id sel

string $classname

Class name

string $prefix

Prefix to title (image or picto)

Return Value

void

void insert(int $idafter, string $url, string $titre, int $level = 0, int $enabled = 1, string $target = '', string $mainmenu = '', string $leftmenu = '', int $position = 0, string $id = '', string $idsel = '', string $classname = '', string $prefix = '')

Insert a menu entry into this->liste (after $idafter)

Parameters

int $idafter

Array key after which inserting new entry

string $url

Url to follow on click

string $titre

Label of menu to add. The value must already be translated.

int $level

Level of menu to add

int $enabled

Menu active or not

string $target

Target link

string $mainmenu

Main menu ('home', 'companies', 'products', ...)

string $leftmenu

Left menu ('setup', 'system', 'admintools', ...)

int $position

Position (not used yet)

string $id Id
string $idsel

Id sel

string $classname

Class name

string $prefix

Prefix to title (image or picto)

Return Value

void

void remove_last()

Remove a menu entry from this->liste

Return Value

void

getNbOfVisibleMenuEntries()

Return number of visible entries (gray or not)

@return int Number of visible (gray or not) menu entries