The action XML element
The main contribution a plugin will bring to the registry is generally a set of “actions”, adding some buttons in one of the GUI toolbar, and declaring a supported callback for this action, thus extending the server API on the fly. This is done by using the
The action tag must contain a name attribute, and can eventually declare a fileDefault or dirDefault attribute. In that case, it will be considered as default for double-clicking an item on the GUI.
GUI Button definition
This is not mandatory (if you want to simply declare a service on the API side, you may not necessarily want to add a button somewhere). But if you want to, you’ll have to cover the following:
- Button label and description: text & title attributes, referring to an i18n library key.
- Button image & icon: src is the old-fashion way of pointing to an image, iconSrc should be preferred to use a font-awesome icon instead.
: in what context will this action appear in the GUI? Whether it’s linked to something being selected (selection), or if not the case, is it only inside a directory (dir), or inside the recycle. Where does it appear : define the toolbar (actionBar) and to which group it belongs (actionbarGroup), and if it appears in the context menu. : if the context refers to a selection, you’ll be able to narrow here the type of selection concerned, files or folder, one or multiple, and even limit to a given set of mime types.
- noUser [true|false]: does it appear if the whole user system is disabled?
- userLogged [only]: if set, it appears only if a user is logged
- read & write: is read (write) right required to see this action
- adminOnly [true|false] : does the action appear only for admin?
Client side code snippet
Once your action is correctly appearing at the place you want, you are able to write a code snippet that will be triggered when the action is fired. Use
This element has two modes:
- Or it can contain a set of elements
In both cases, if you are using a dialog, you can use the attributes dialogOkButtonOnly or dialogSkipButtons to customize the standard buttons (that are OK / Cancel by default).
Server side callback
If you declare a
You can define submenus for your action, in either
- a static mode: submenu elements are defined directly in the XML. Use the
element, and add , elements with an actionId attribute referring to other already defined actions.