With the template (recommended)
jds plugin neu "My Plugin"
The official cookiecutter template asks what your plugin should contain – settings page, shortcode, own page, database table with admin, tests – and generates a complete, working plugin that passes the marketplace check right away. Use --standard to generate everything without questions.
Without a JDS Web installation, use cookiecutter directly:
pip install cookiecutter
cookiecutter https://jds-web.dpdns.org/marktplatz/plugin-vorlage.zip
Then run jds setup, restart the server, activate it in the admin and run the included tests with jds test plugins.my_plugin.
What a plugin looks like
The heart is plugins/my_plugin/plugin.py:
PLUGIN = {
"name": "My Plugin",
"description": "What it does.",
"version": "1.0",
"settings": {"text": {"label": "Text", "default": "Hello!"}},
}
def register(hooks):
@hooks.add_action("footer")
def hello(**kwargs):
return f"<p>{hooks.setting('text')}</p>"
Restart the server and activate it in the admin under System → Plugins. The admin builds a settings page from settings automatically (types: text, textarea, bool, email, number, color).
What else a plugin can do
models.py+admin.py– own data with an admin page (hidden while the plugin is off:core.admin_utils.PluginModelAdmin)urls.py– own pages under/plugin/<name>/or, with"url_prefix", e.g. under/doku/templates/– own templatesactivate()/deactivate()– run when switched on/off
Complete example: plugins/kontaktformular/.