Pluggable menus in Evolution
By default each plugin has a single menu entry for loading plugin main page (for each user access level).
Evolution skin supports adding more menu entries from plugins. This feature is called pluggable menus.
Enabling pluggable menus
Pluggable menus are enabled by adding extra configuration lines in plugin.conf
file.
New entries are menu_admin
, menu_reseller
and menu_user
. The value should be a relative path to a plugin script, which when executed would return additional menu entries in JSON format.
Example plugin.conf
file:
...
menu_admin=images/menu.json
menu_reseller=images/menu.json
menu_user=images/menu.json
Adding these three lines will enable pluggable menus for all user levels and will instruct DirectAdmin to load static menu file from:
/usr/local/directadmin/plugins/{name}/images/menu.json
In this example menu is placed in ./images
directory to prevent it being rendered inside the skin template used for showing plugin GUI.
Menu content can be generated dynamically by using plugin scripts in RAW mode.
Menu file output
Menu file should be a valid JSON document. It is an array of menu category objects. Structure of menu category object:
Field | Type | Description |
---|---|---|
name | string | Visible menu category text |
icon | URL | URL used to load menu icon |
entries | array of objects | List menu menu entries in this menu category |
Each category can include list or menu entries described by the menu entry object. Object structure:
Field | Type | Description |
---|---|---|
name | string | Visible menu entry text |
icon | URL | Link to menu entry icon |
href | URL | Link to open whem menu entry is clicked |
newTab | boolean | When true menu entry will be opened in a new tab, useful for external links or scripts working in RAW mode |
updates | integer | When set to value other than 0 would show an extra icon to the menu entry hinting there are a given number of events inside |
Example of static pluggable menu file:
[
{
"name": "Useful links",
"icon": "https://directadmin.com/favicon.png",
"entries": [
{
"name": "Google",
"icon": "https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png",
"href": "https://google.com",
"newTab": true,
"updates": 1
},
{
"name": "Wikipedia",
"icon": "https://en.wikipedia.org/static/favicon/wikipedia.ico",
"href": "https://en.wikipedia.org",
"newTab": false,
"updates": 0
}
]
}
]