-
Notifications
You must be signed in to change notification settings - Fork 1
Link module tutorial
You must create a subfolder for your module in the module folder. Your folder name will be your module name, which must match in all other places where your module name is needed.
/module/your_module_name
You must create a JavaScript file inside this folder with the name your_module_name.js. For example, if you are creating a special link module to make it easier to link to Wikipedia pages, you might end up with something like:
/module/wikipedia/wikipedia.js
Your JavaScript file must contain a function with the name your_module_name_menuitem. (In other words append _menuitem to your_module_name for the name of the function.
As the module creator you can choose whether to accept strings, numbers, arrays and/or objects for the args parameter.
The function must return the full url you intend to link to.
The function inside our wikipedia example might look something like this:
/* Link module for wikipedia pages. For args we expect a string with the page name. */
function wikipedia_menuitem(args) {
var page_name = args.replace(/\s/g,"_");
return "https://en.wikipedia.org/wiki/"+page_name;
}