-
Notifications
You must be signed in to change notification settings - Fork 287
Plugin Compatibility
This is a short guide to creating an plugin that is compatible with the Adapt authoring tool.
The tool supports component, extension, theme, and menu plugin types (although only components and extensions are currently configurable in the tool).
It is not recommended that you develop new plug-ins directly in the authoring tool. However, if you are well-acquainted with the backend of the authoring tool, you can try this alternative approach. Upload a basic scaffold of the plug-in along with a well defined properties.schema file. Locate your plug-in by name in the temp/adapt_framework folder, and develop your code there.
Most developers find it more efficient to take a two-step approach:
- develop the plug-in using the Adapt framework
- test and tweak within the authoring tool
The first step is to write the code. If this is your first time, it might be a good idea to follow our guide for creating a standard Adapt framework plugin.
To allow your plug-in to be installed in the authoring tool, you need to take a few extra steps:
Make sure that you define the following two attributes are in your bower.json
:
You need to add a displayName
attribute. This is the user-friendly name for your plugin as it will appear in the editor. Note that this value doesn't necessarily have to be unique, but may make the experience confusing for the end user if it matches the displayName
of another plugin.
The tool will need to know what type of plugin you have created (i.e. component, extension menu, or theme).
This is specified in the JSON using the type itself as the key, with your plugin's unique name (i.e. not its displayName
) as the value. If you have registered your plugin using Adapt's CLI, this should be the value passed to Adapt.register
.
For example:
"theme": "adapt-contrib-vanilla"
To allow your plugin to expose attributes to the user for editing, you must define those attributes in a json-schema file named properties.schema
.
To allow your schema to inherit certain properties from pre-defined authoring tool schemas, make sure you set the $ref
value to point to the correct schema for your plugin type:
- Components:
http://localhost/plugins/content/component/model.schema
- Themes:
http://localhost/plugins/content/theme/model.schema
- Menus:
http://localhost/plugins/content/menu/model.schema
- Extensions: (not required)
Besides the $ref
, your properties.schema
file is otherwise a standard json schema file which defines the attributes that will be added to the course JSON output and read by your plugin.
If you're new to properties.schema
files, head over to our introductory wiki page for an overview.
See below for links to some examples of properties.schema
files for core plugins:
The authoring tool uses the Semver version syntax to determine the release order of plugins. Therefore, if you want to upload your plugin to the tool, it must have a valid version
attribute in both the package.json
and bower.json
files (and preferably also a corresponding tag attached to your git repository -- GitHub have written some nice instructions on how to do this).
If you want to upload a new version of your plugin, you must make sure to bump the version number in the package.json
and bower.json
files, or the authoring tool will give you an error.