| @@ -11,8 +11,9 @@ | ||
| 11 | 11 | use Forge12\DoubleOptIn\Container\Container; |
| 12 | 12 | use Forge12\DoubleOptIn\Container\BootableProviderInterface; |
| 13 | 13 | use Forge12\DoubleOptIn\EmailTemplates\EmailTemplatePostType; |
| 14 | 14 | use Forge12\DoubleOptIn\EmailTemplates\EmailTemplateRepository; |
| 15 | +use Forge12\DoubleOptIn\EmailTemplates\EmailTemplateRestController; | |
| 15 | 16 | use Forge12\DoubleOptIn\EmailTemplates\EmailHtmlGenerator; |
| 16 | 17 | use Forge12\DoubleOptIn\EmailTemplates\EmailTemplateIntegration; |
| 17 | 18 | use Forge12\DoubleOptIn\EmailTemplates\BlockRegistry; |
| 18 | 19 | |
| @@ -54,11 +55,18 @@ | ||
| 54 | 55 | return new EmailHtmlGenerator(); |
| 55 | 56 | } |
| 56 | 57 | ); |
| 57 | 58 | |
| 58 | - // The template REST routes (editing) belong to the email editor | |
| 59 | - // add-on since Core 5.8 / add-on 1.1.0. Core keeps what renders | |
| 60 | - // saved templates at send time. | |
| 59 | + // Register REST Controller | |
| 60 | + $container->singleton( | |
| 61 | + EmailTemplateRestController::class, | |
| 62 | + function ( Container $c ) { | |
| 63 | + return new EmailTemplateRestController( | |
| 64 | + $c->get( EmailTemplateRepository::class ), | |
| 65 | + $c->get( EmailHtmlGenerator::class ) | |
| 66 | + ); | |
| 67 | + } | |
| 68 | + ); | |
| 61 | 69 | |
| 62 | 70 | // Register Block Registry |
| 63 | 71 | $container->singleton( |
| 64 | 72 | BlockRegistry::class, |
| @@ -85,10 +93,13 @@ | ||
| 85 | 93 | // the registered post type (admin column, capabilities, etc.). |
| 86 | 94 | $postType = $container->get( EmailTemplatePostType::class ); |
| 87 | 95 | $postType->init(); |
| 88 | 96 | |
| 89 | - // The template REST routes live in addon-email-editor (1.1.0+), | |
| 90 | - // which registers them itself. Core ships no editing code. | |
| 97 | + // REST controller registration is OWNED BY addon-email-editor: | |
| 98 | + // its boot() picks the controller up from the same container | |
| 99 | + // and calls init() only when the addon is licensed + active. | |
| 100 | + // Free / unlicensed sites get no API surface, which is the | |
| 101 | + // intent of Pro-gating the editor + templates feature. | |
| 91 | 102 | |
| 92 | 103 | // Initialize Integration with CF7/Avada — used by the email |
| 93 | 104 | // pipeline for templates referenced in form settings, so it |
| 94 | 105 | // stays in Core (otherwise free users couldn't send templated |