Plugin
Caution
The Plugin system is currently under revision and is most likely to change significantly in release 0.12
Plugins provide users and developers the ability to have a modular system of extending the functionality of the spacialist software without the need of having all functionality in one gigantic application.
Plugin Flow
Upload > Install > Activate >< Deactivate < Uninstall < Remove
Plugin Structure
- 📂 .vscode
- 📂 App*
- Main.php*
- 📂 build
- 📂 Migration
- 📂 routes
- 📂 storage
- 📂 src
- 📂 components
- App.vue
- main.js
- manifest.xml*
- package.json*
- index.html*
- README.md*
- CHANGELOG.md*
- vite.config.js*
* required
Plugin Permissions
Plugins can be hooked to a variety of locations of the Spacialist.
Backend
- Migrations
- Routes
- Models
- Storage
Frontend
- as Links
- SettingsDropdown
- as Components
- DetailsTab
- as Views
- Routes
Operations
Currently available options are:
- is required to be called by the plugin (unless it only uses PHP)
Register
You need to register a plugin with the register function:
register({id*, i18n, routes, store})
- Id string - is required and must be unique for your plugin.
- i18n i18nObject - automatically calls the registerI18N(i18n) method
- routes - routesArray automatically calls the registerRoutes(routes) method
- store store of the plugin to register
Register I18N
The i18n method is used to register the i18n files of the plugin.
registerI18N(id*, i18n*)
- Id string - unique id string of the plugin.
- i18n i18nObject - the i18n object of the plugin.
I18N Object
The i18n object is a JSON object with the following structure:
{
"en": {
"message": "This is a message in english."
...
},
"de": {
"message": "Dies ist eine Nachricht auf deutsch."
...
}
}
Register Routes
The routes method is used to register the routes of the plugin.
registerRoutes(id*, routes*)
- Id string - unique id string of the plugin.
- routes routesArray - the routes object of the plugin.
Routes Array
Array that contains vue-router routes. For example:
...
[
{
"path": "/plugin",
"name": "plugin",
"component": MyPluginComponent,
"meta": {
"title": "Plugin"
}
},
...
]
Register Preferences
The preferences method is used to register the preferences of the plugin.
registerRoutes({
of*,
key*,
label*,
category*,
subcatogery*,
custom_subcategory,
custom_label,
component,
componentTag,
data,
default_value
})
- of string - unique id string of the plugin.
- key string - unique key string of the preference.
- label string - label of the preference.
- category ["system","user"] - category of the preference ().
- subcategory string - subcategory of the preference.
- custom_subcategory string - custom subcategory of the preference.
- custom_label string - custom label of the preference. Must be set if custom_subcategory is set.
- component string - component of the preference.
- componentTag string - tag of the component.
Into Slot
The intoSlot method is used to register the plugin into a slot. E.g. the 'Tab' view of the details page.
intoSlot({
of*,
slot*,
component,
componentTag,
key,
icon,
label,
href
})
- of string - unique id string of the plugin.
- slot ["tab","tools","settings"] - unique slot string of the plugin.
- key string - unique key string of the slot.
- icon string - icon of the slot.
- label string - label of the slot.
- href string - Unknown at the moment.
- component string - component of the slot. Requires componentTag to be set.
- componentTag string - tag of the component, defaults to key.