{% extends "base.html" %} {% block title %}Plugins{% endblock %} {% block content %}

Plugins

Plugin packages loaded from the plugins/ directory. Changes require a server restart to take effect.

{{ plugins|length }} plugin{% if plugins|length != 1 %}s{% endif %} loaded
{% if plugins %}
{% for plugin in plugins %}

{{ plugin.name }}

id: {{ plugin.id }} {% if plugin.author %} — {{ plugin.author }}{% endif %}

{% if plugin.description %}

{{ plugin.description }}

{% endif %}
v{{ plugin.version }} Settings
{% endfor %}
{% else %}

No plugins loaded

Create a Python package in the plugins/ directory and restart the server.

# plugins/my_plugin/__init__.py

PLUGIN_META = {'{'}{"id": "my-plugin", "name": "My Plugin", "version": "1.0.0"}{'}'}

 

def register(ctx):

    from .routes import router

    ctx.include_router(router, prefix="/my-plugin")

{% endif %}

Plugin API Quick Reference

Import path

from app.fastcms_plugin_api import PluginContext

Used automatically — ctx is passed to register()

PluginContext methods

ctx.include_router(router, prefix=...)

ctx.on_record_create(collection, handler)

ctx.add_admin_page(nav_id=..., label=..., icon=..., url=...)

ctx.get_setting(key, default=None)

{% endblock %}