diff --git a/classes/plugin/Gpm.php b/classes/plugin/Gpm.php
index 689da802..fc076438 100644
--- a/classes/plugin/Gpm.php
+++ b/classes/plugin/Gpm.php
@@ -423,6 +423,25 @@ class Gpm
$script = $folder . '/system/install.php';
/** Install $installer */
if ((file_exists($script) && $install = include $script) && is_callable($install)) {
+ // Run preflight from the NEW package's installer if available
+ if (is_object($install) && method_exists($install, 'generatePreflightReport')) {
+ $report = $install->generatePreflightReport();
+ $blocking = $report['blocking'] ?? [];
+ $incompatible = $report['incompatible_packages'] ?? [];
+
+ if (!empty($blocking) || !empty($incompatible['blocking'])) {
+ $errors = [];
+ foreach ($blocking as $reason) {
+ $errors[] = $reason;
+ }
+ foreach ($incompatible['blocking'] ?? [] as $slug => $info) {
+ $errors[] = sprintf('%s (%s v%s) — not compatible with Grav %s. Disable it to proceed.',
+ $slug, $info['type'] ?? 'plugin', $info['version'] ?? '?', $incompatible['target'] ?? '?');
+ }
+ Installer::setError(implode('
', $errors));
+ return;
+ }
+ }
$install($zip);
} else {
Installer::install(
diff --git a/themes/grav/scss/template/_gpm.scss b/themes/grav/scss/template/_gpm.scss
index bd560f6f..91460b6d 100644
--- a/themes/grav/scss/template/_gpm.scss
+++ b/themes/grav/scss/template/_gpm.scss
@@ -84,6 +84,29 @@
line-height: 1.3;
}
+ .gpm-compat {
+ @extend .badge;
+ border-radius: 3px;
+ padding: 0 4px;
+ font-size: 0.75rem;
+ margin-left: 2px;
+ }
+
+ .gpm-compat-17 {
+ background: #3b82f6;
+ color: white;
+ }
+
+ .gpm-compat-18 {
+ background: #22c55e;
+ color: white;
+ }
+
+ .gpm-compat-api {
+ background: #06b6d4;
+ color: white;
+ }
+
.gpm-actions {
.enabled, .disabled {
diff --git a/themes/grav/templates/partials/plugin-data.html.twig b/themes/grav/templates/partials/plugin-data.html.twig
index 435b0671..6f0f6a4e 100644
--- a/themes/grav/templates/partials/plugin-data.html.twig
+++ b/themes/grav/templates/partials/plugin-data.html.twig
@@ -49,6 +49,18 @@
{% endif %}
+