WIKINDX API trunk

MENU
in package

MENU

Configure, create and print menus

Table of Contents

Properties

$menus  : mixed
array

Methods

__construct()  : mixed
MENU class
menus()  : mixed
Create the menu array.
noMenu()  : mixed
no drop-down menu system

Properties

$menus

array

public mixed $menus

Methods

__construct()

MENU class

public __construct() : mixed

menus()

Create the menu array.

public menus() : mixed

The order of menu display follows the order of $this->configureXXXmenu() functions. Each top-level menu item in the $menu array has a 'submenu' item which comprises an array of the top-level menu's individual items. Each of those items can have a submenu and each submenu can have a subsubmenu. Thus, three levels in total. In practice, most menu items comprise one level.

The admin can configure which menus and which of their items are available to users. This is controlled through $this->menuConfig: Main menus and each of their items have an 'index' element. Main menus and their items each have their own index series. These are used for cross-referencing to the array of available menus and menu items in the configMenuDesktopConfig and configMenuMobileConfig rows of the config table in the database. Main menus and each of their items have a 'configure' element. To ensure that the admin cannot configure a menu or a menu item, set 'configure' => FALSE, otherwise TRUE. Be careful changing existing menu index numbers. You can move menus and their items to different display positions but do not change the index. If you must change the index number (I cannot think of any reason why), then you must also set the configMenuDesktopConfig and configMenuMobileConfig rows in the config table to WIKINDX_MENU_DESKTOP_CONFIG_DEFAULT and WIKINDX_MENU_DESKTOP_CONFIG_DEFAULT respectively through UPDATEDATABASE—otherwise the indices might no longer correlate with what the admin has configured.

While Plugin (x) menus have 'index' and 'configure' elements, their items do not—they should be disabled in the Admin|Components interface. Plugins inserted in other menus do not exist in $this->menuConfig—they should be disabled in the Admin|Components interface.

A 'submenu' item comprises arrays, each representing a menu item at that level. Each such array must have the following three elements: 'text' — what is displayed to the user (string) 'link' — the menu item's URL (string or FALSE) 'tooltip' — any help displayed to the user when the mouse hovers over the menu item (string)

The first element of a menu array (e.g., 'wikindx' or 'res') must have a noMenu URL — when the user clicks on this, a list of hyperlinked menu items from the array is displayed in the main body. For example, the first array of the 'wikindx' menu array should have a 'link' element so: $array = [ 'text' => 'Wikindx', 'link' => 'index.php?action=noMenu&method=wikindx', 'tooltip' => '' ];

The second element of a menu array is always the main 'submenu' element of menu items in the menu list. For example: $array['submenu'][] = [ 'text' => \LOCALES\get_core_message("menu", "news"), 'link' => 'index.php?action=news_NEWS_CORE&method=viewNews', 'tooltip' => '' ];

A $array['submenu'][] item can itself have a 'submenu' element. In these cases, create the submenu array first as for the main level then insert it into $array['submenu']. Note that the array into which the submenu array is inserted should have a 'link' element which is FALSE. For example, if the submenu is encapsulated in $submenu: $array['submenu'][] = [ 'text' => \LOCALES\get_core_message("menu", "statisticsSub"), 'link' => FALSE, 'tooltip' => $this->tooltip('statisticsSub'), 'submenu' => $submenu ]; Note that multiple levels of submenu are not pesent in $this->menuConfig: only the main menu submenu can be conbfigured.

Follow precisely the same approach when creating a subsubmenu (i.e., the third level) — create the subsubmenu array first, create the submenu next, inserting the subsubmenu array into the 'submenu' element of the submenu array's target element (setting 'link' to FALSE), then insert the submenu array into $array['submenu'].

noMenu()

no drop-down menu system

public noMenu() : mixed

Produce standard hyperlinks in body of page


        
On this page

Search results