Plugin Development
This page will go through how to create a Plugin for Organizr
Last updated
This page will go through how to create a Plugin for Organizr
Last updated
This only pertains to Organizr instances on version 2.1.1140 or higher
Each plugin consists of the following files:
File Name | Description |
---|---|
The first thing you will notice is that there is a Global variable set with a plugins
array. For this example, our Plugin name is Test
.
Also notice on the array we again specify the name of the plugin. Here is a breakdown of the rest of the array keys:
Now that we have finished setting up your Plugin's Global variable array, we can now continue to creating your Plugin's PHP Class.
If you plan on using some of Organizr built in functions and User information, you will need to extend the Organizr Class. Otherwise, you can just create a new class and that is it.
If you want a settings modal, you will need to create a function to supply which config items you will want to set up for your settings modal. Let's start with creating a function to pass an array with our config items.
First, you need to name your function something, let's call this one _pluginGetSettings
, we can also set this function as public if you choose to share those variables with other classes etc...
Next, we will return an array with our Setting's groups. In this example our first Group is called Sample Settings
. Inside this Settings group, we will have 3 config items that we want to setup. Each item is setup via the settingsOption
function. This function takes 3 parameters.
public function OptionsFunction::settingsOption($type, $name = null, $extras = null) array|string[]
The first option is the type of config item that we are setting up. The second, is the name of the config item. Lastly, we can provide the sometimes-optional extra options needed to set the item up.
Let's take a look at each one.
You can find out all the type of config item options under the options-functions.php
file located under Organizr Location/api/functions/
folder.
Key | Value Type | Description |
---|---|---|
Config Item Name | Config Type | Extra Options |
---|---|---|
plugin.php
The file is the PHP Class file that will have all your plugins functions and everything
api.php
This file will contain all the API routes for your plugin
config.php
This file will contain all of your plugins default config values
page.php [OPTIONAL]
This file can hold some html that Organizr can display if you set a Tab in Organizr as Organizr type
main.js
This Javascript file will be included when Organizr loads if your plugin is enabled
settings.js [OPTIONAL]
This Javascript file will be included when Organizr loads the settings page if your plugin is enabled
logo.png
The logo file for your plugin
author
String
Your name or pseudonym
category
String
Overall type of Plugin
link
String
Link to additional info for plugin, can be blank
license
String
Can be either personal or business. Can also be both just use csv.
I.E. personal,business
idPrefix
String
This is used for HTML elements, please use all Uppercase and one word only
configPrefix
String
This is used for config items so they don't clash with other items. Please use all Uppercase and no spaces
version
String
SemVer of your plugin
image
String
Path to your logo
settings
Boolean
Does your plugin need a settings modal
bind
Boolean
Use the default bind to make settings modal
api
String
API Route to settings values
homepage
Boolean
NOT IN USE YET
TEST-pass-alt
password-alt
label
TEST-password
password
label
TEST-text
text
label
N/A
html
html