| @@ -266,8 +266,11 @@ | ||
| 266 | 266 | 'consentExportNonce' => wp_create_nonce( 'doi_consent_export' ), |
| 267 | 267 | // Setup wizard state for the dashboard card. Null on sites that |
| 268 | 268 | // were installed before the wizard existed. |
| 269 | 269 | 'setup' => $this->setupState(), |
| 270 | + // Installed form plugins, so the forms page offers only add-ons | |
| 271 | + // for plugins this site actually runs. | |
| 272 | + 'formPlugins' => $this->formPlugins(), | |
| 270 | 273 | ); |
| 271 | 274 | |
| 272 | 275 | /** |
| 273 | 276 | * Filter the admin SPA configuration data. |
| @@ -294,8 +297,24 @@ | ||
| 294 | 297 | * |
| 295 | 298 | * @param string $from Entry point recorded on the link. |
| 296 | 299 | * @param string $fallback Used when core/feedback.php is not loaded. |
| 297 | 300 | */ |
| 301 | + /** | |
| 302 | + * @return array<int, array{id: string, name: string, addonLoaded: bool, productUrl: string}> | |
| 303 | + */ | |
| 304 | + private function formPlugins(): array { | |
| 305 | + $plugins = array(); | |
| 306 | + foreach ( ( new \Forge12\DoubleOptIn\Setup\FormPluginDetector() )->installed() as $plugin ) { | |
| 307 | + $plugins[] = array( | |
| 308 | + 'id' => $plugin['id'], | |
| 309 | + 'name' => $plugin['name'], | |
| 310 | + 'addonLoaded' => $plugin['addonLoaded'], | |
| 311 | + 'productUrl' => $this->productUrl( 'forms-detected-' . $plugin['id'], '' ), | |
| 312 | + ); | |
| 313 | + } | |
| 314 | + return $plugins; | |
| 315 | + } | |
| 316 | + | |
| 298 | 317 | /** |
| 299 | 318 | * @return array{status: string, step: int, steps: int}|null |
| 300 | 319 | */ |
| 301 | 320 | private function setupState(): ?array { |