Table of Contents
MenuExt Plugin
Compatible with DokuWiki
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" yes
- 2018-04-22 "Greebo" unknown
- 2017-02-19 "Frusterick Manners" unknown
This plugin allows Wiki administrators to add arbitrary links into DokuWiki's Menus by editing a simple configuration file.
Installation
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Configuration
To make use of the plugin, you need to create a [DOKUWIKI'S ROOT]/conf/menuext.json
(not in the plugin's directory). Here's the example that comes with the plugin:
- conf/menuext.json
{ "page": [ { "order": 3, "label": { "en": "Google Search", "de": "Google Suche" }, "title": { "en": "Execute a Google search on the current page ID", "de": "Führe eine Google Suche mit der aktuellen Seiten-ID aus" }, "link": "https://www.google.com/search?q=@ID@", "svg": "google.svg", "attr": { "target": "_blank" } }, { "action": "login" }, { "classname": "\\dokuwiki\\plugin\\dw2pdf\\MenuItem" } ] }
As you can see, it's a nested structure configuring the menu items. The top level defines the menu to add to (see Available Menus) For each you can define the items to add.
order | Position to add this item (starts at 0). Defaults to to add at the end. Use negative numbers to count from the end |
label | The label to show on the menu item. One entry per language. |
title | The title to show on mouseover. One entry per language. |
link | The link to use when clicking the item, can contain Replacement Patterns |
svg | The SVG icon to use. Can be a media ID, an absolute file name or a icon from materialdesignicons.com (auto downloaded from the latter) |
attr | additional attributes to set on the A node in HTML |
Alternatively to creating custom items, you can also reuse existing items by specifying the action
or classname
parameters. Above example adds the login/logout button and PDF export button to the page menu. The second example is redundant in case of page menu (it will double the PDF button), but it demonstrates how to add items supplied by plugins.
order | Position to add this item (starts at 0). Defaults to to add at the end. Use negative numbers to count from the end |
action | A standard action (see action_modes). Please note that not all actions do have corresponding MenuItems available |
classname | Fully qualified class name of a menu item created by a plugin, meaning a class extending dokuwiki\Menu\Item\AbstractItem |
Javascript
You can attach Javascript to your items by specifying the function to be called on click:
"attr": { "onclick": "hello()" }
Remember, you are in global scope, so your method must be available there.