Plugin system: content vs system types, sidebar-aware UI, arrow visibility

- plugin.json type field: 'content' (sidebar) or 'system' (API only)
- Content-edit: label 'Plugins', hide section if layout has no sidebar
- Content-edit: disable checkboxes when no sidebar layout selected
- Content-edit: hide up arrow on first item, down arrow on last item
- PluginManager: isPluginViewable() checks type=system -> not viewable
- Admin plugins page: show Content/Systeem type badge
- HTMLBlock: add plugin.json with type=content
- Navigation: add type=content to config
This commit is contained in:
2026-08-11 17:22:41 +02:00
parent 8ebfcb6061
commit 73450a17c1
7 changed files with 80 additions and 24 deletions
+19 -2
View File
@@ -508,9 +508,10 @@ function handleContentEdit($auth, $config, $twig, $user, $csrf, $siteConfig): vo
}
}
// Get available plugins (must have plugin.json or <PluginName>.php)
// Get available content plugins (type=content in plugin.json, or no type = content)
$pluginsDir = $config['plugins_dir'];
$availablePlugins = [];
$sidebarLayouts = [];
if (is_dir($pluginsDir)) {
foreach (glob($pluginsDir . '*', GLOB_ONLYDIR) as $pluginDir) {
$pluginName = basename($pluginDir);
@@ -518,12 +519,27 @@ function handleContentEdit($auth, $config, $twig, $user, $csrf, $siteConfig): vo
$hasJson = file_exists($pluginDir . '/plugin.json');
$hasPhp = file_exists($pluginDir . '/' . $pluginName . '.php');
if ($hasJson || $hasPhp) {
$availablePlugins[] = $pluginName;
// Check plugin type — only content plugins show in sidebar
$pluginType = 'content';
if ($hasJson) {
$pj = json_decode(file_get_contents($pluginDir . '/plugin.json'), true);
$pluginType = $pj['type'] ?? 'content';
}
if ($pluginType === 'content') {
$availablePlugins[] = $pluginName;
}
}
}
}
}
// Determine which layouts have a sidebar (based on theme twig files)
foreach ($themeLayouts as $key => $twigFile) {
if (strpos($key, 'sidebar') !== false) {
$sidebarLayouts[] = $key;
}
}
$currentLang = extractLanguagePrefix($file);
$route = 'content-edit';
$fileDir = trim(dirname($file), '.\\/');
@@ -541,6 +557,7 @@ function handleContentEdit($auth, $config, $twig, $user, $csrf, $siteConfig): vo
'currentLayout' => $currentLayout ?: $themeDefaultLayout,
'themeLayouts' => $themeLayouts,
'themeDefaultLayout' => $themeDefaultLayout,
'sidebarLayouts' => $sidebarLayouts,
'activeThemeName' => $activeThemeName,
'availablePlugins' => $availablePlugins,
'selectedPlugins' => $selectedPlugins,