Plugin Development
This page will go through how to create a Plugin for Organizr
This only pertains to Organizr instances on version 2.1.1140 or higher
Folder Structure
Each plugin consists of the following files:
File Development
plugin.php
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.
config.php
Last updated