DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:menuext

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:menuext [2021-07-20 23:51] – version upped andiplugin:menuext [2023-03-02 13:52] (current) annda
Line 6: Line 6:
 email      : dokuwiki@cosmocode.de email      : dokuwiki@cosmocode.de
 type       : action type       : action
-lastupdate : 2021-07-20 +lastupdate : 2021-07-29 
-compatible : hogfather+compatible : Hogfather, Igor
 depends    :  depends    : 
 conflicts  conflicts 
Line 29: Line 29:
 ===== Configuration ===== ===== Configuration =====
  
-To make use of the plugin, you need to create a ''conf/menuext.json'' file. Here's the example that comes with the plugin:+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:
  
 <code json conf/menuext.json> <code json conf/menuext.json>
Line 49: Line 49:
                 "target": "_blank"                 "target": "_blank"
             }             }
 +        },
 +        {
 +            "action": "login"
 +        },
 +        {
 +            "classname": "\\dokuwiki\\plugin\\dw2pdf\\MenuItem"
         }         }
     ]     ]
Line 64: Line 70:
 | svg   | The SVG icon to use. Can be a media ID, an absolute file name or a icon from [[https://materialdesignicons.com/|materialdesignicons.com]] (auto downloaded from the latter) | | svg   | The SVG icon to use. Can be a media ID, an absolute file name or a icon from [[https://materialdesignicons.com/|materialdesignicons.com]] (auto downloaded from the latter) |
 | attr  | additional attributes to set on the A node in HTML | | 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 [[devel: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:
 +
 +<code>
 +  "attr": {
 +    "onclick": "hello()"
 +  }
 +</code>
 +
 +Remember, you are in global scope, so your method must be available there.
 +
 +
plugin/menuext.1626817863.txt.gz · Last modified: 2021-07-20 23:51 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki