pipeline = $pipeline; $this->formsRepo = $formsRepo; $this->submissionsRepo = $submissionsRepo; $this->gate = $gate; $this->fieldRegistry = $fieldRegistry; $this->compiler = $compiler; $this->settings = $settings; $this->captchaManager = $captchaManager; $this->publicSubmitApi = $publicSubmitApi; Logger::debug( 'RestController (router) initialized' ); } /** * Register all REST API routes by delegating to domain controllers. * * Each controller owns its own route definitions, permission callbacks, * and request handling. This method simply instantiates and delegates. */ public function register_routes(): void { // ── Domain API controllers (Phase 1.1) ───────────────────────── $formsApi = new FormsApi( $this->formsRepo, $this->submissionsRepo, $this->gate, $this->settings, $this->captchaManager ); $formsApi->registerRoutes(); $submissionsApi = new SubmissionsApi( $this->formsRepo, $this->submissionsRepo, $this->gate ); $submissionsApi->registerRoutes(); $publicSubmitApi = $this->publicSubmitApi ?? new PublicSubmitApi( $this->pipeline, $this->formsRepo, $this->submissionsRepo, $this->compiler, $this->captchaManager ); $publicSubmitApi->registerRoutes(); $fieldsApi = new FieldsApi( $this->fieldRegistry, $this->gate, $this->settings ); $fieldsApi->registerRoutes(); // ── Already-extracted controllers ────────────────────────────── if ( $this->settings ) { $settingsApi = new SettingsApi( $this->settings ); $settingsApi->registerRoutes(); } ( new WebhooksApi() )->registerRoutes(); ( new EmailMarketingApi() )->registerRoutes(); ( new CrmApi() )->registerRoutes(); $dashboardApi = new DashboardApi( $this->formsRepo, $this->submissionsRepo, $this->settings ); $dashboardApi->registerRoutes(); $onboardingApi = new OnboardingApi(); $onboardingApi->registerRoutes(); $toolsApi = new ToolsApi( $this->formsRepo, $this->submissionsRepo, $this->gate ); $toolsApi->registerRoutes(); $reportsApi = new ReportsApi( $this->formsRepo, $this->submissionsRepo, $this->gate ); $reportsApi->registerRoutes(); // The active theme's colours, fonts and button look for the builder (2.7.2). ( new AppearanceApi( $this->gate ) )->registerRoutes(); // Blocked spam counts and the spam protection offer (2.6.0). ( new SpamApi( $this->formsRepo, $this->gate ) )->registerRoutes(); // Fresh-install import offer (2.7.2). ( new ImportOfferApi( $this->gate ) )->registerRoutes(); \SubtleForms\Tools\ApiLog::register(); } }