- Admin guide: RBAC roles, role-based dashboard, plugin types (content/system) - CodePress developer guide: plugin types, admin plugin API, SCSS compilation, asset serving - Theme developer guide: SCSS sole CSS source, css_compiled read-only, guide layout - Content manager guide: layout selection from theme.json, plugin order in frontmatter - Both NL and EN updated with identical structure - 35 files updated
49 lines
2.0 KiB
Markdown
49 lines
2.0 KiB
Markdown
# Plugins
|
|
|
|
## Plugin types
|
|
|
|
CodePress has two kinds of plugins, determined by the `type` field in `plugin.json`:
|
|
|
|
- **Content plugins** (`type: "content"`) — Appear in the sidebar and in the plugin selection on content-edit pages. Provide sidebar content via `getSidebarContent()`.
|
|
- **System plugins** (`type: "system"`) — Are loaded by PluginManager but do NOT appear in the sidebar. Provide functionality via admin menu, routes and the CMSAPI. Registered via `getAdminMenu()` and `getAdminRoutes()`.
|
|
|
|
When no `type` field is present, `content` is assumed.
|
|
|
|
## Essential plugins
|
|
|
|
Essential plugins are defined in `getProtectedPlugins()` in `public/admin.php`. Current essential plugin: **Navigation**.
|
|
|
|
These plugins:
|
|
- Cannot be deactivated
|
|
- Cannot be edited
|
|
- Cannot be deleted
|
|
|
|
On the plugins page they get an **Essential** badge instead of the action buttons.
|
|
|
|
## Managing plugins
|
|
|
|
- **Activate/Deactivate** — Turn a plugin on/off (not for essential plugins)
|
|
- **Edit** — Modify plugin code in CodeMirror (not for essential plugins)
|
|
- **Configuration** — Edit plugin settings
|
|
- **Delete** — Remove the plugin folder (not for essential plugins)
|
|
|
|
The admin plugins page shows a **Content** or **System** badge per plugin.
|
|
|
|
## Creating a new plugin
|
|
|
|
1. Go to **Plugins** → **New plugin**
|
|
2. Enter a name (e.g. `MyPlugin`) — this becomes the folder name
|
|
3. Choose the type: **Content** or **System**
|
|
4. The file `MyPlugin.php` is created (NOT `plugin.php`)
|
|
5. Edit the plugin code in CodeMirror
|
|
6. Activate the plugin
|
|
|
|
## Plugin filename
|
|
|
|
Plugin PHP files are named `<PluginName>.php` (e.g. `Navigation.php`, `HTMLBlock.php`). `PluginManager` loads `$pluginDir . '/' . $pluginName . '.php'`.
|
|
|
|
## Plugin CSS
|
|
|
|
- Content and system plugins can have their own CSS in `assets/scss/` and `assets/css/`
|
|
- Plugin CSS is automatically loaded after theme CSS (in `base.twig`), so themes can override plugin styling
|
|
- Plugin assets are served via `cms/router.php` at URL `/plugins/<Name>/assets/...` |