← All changes
|
app/Http/Controllers/EmailNotificationController.php
+8
-0
1.6.0
→
1.6.5
View file →
| @@ -155,8 +155,16 @@ | ||
| 155 | 155 | |
| 156 | 156 | $previewService = new EmailPreviewService(); |
| 157 | 157 | $data = $previewService->getPreviewData($template); |
| 158 | 158 | |
| 159 | + // Let add-ons adjust the preview data for their own templates — e.g. unset | |
| 160 | + // `order` so an orderless notification (wishlist, withdrawal, …) previews | |
| 161 | + // without the order header (emails.parts.order_header renders only when | |
| 162 | + // $order is non-empty), or add the sample context their smartcodes need. | |
| 163 | + // Core templates are untouched: no core listener changes $data. The context | |
| 164 | + // is an array so more keys can be added later without changing the signature. | |
| 165 | + $data = apply_filters('fluent_cart/email/preview_data', $data, ['template' => $template]); | |
| 166 | + | |
| 159 | 167 | $body = TemplateService::getTemplateByPathName($template, $data); |
| 160 | 168 | |
| 161 | 169 | // Wrap in the same outer email template used by actual emails |
| 162 | 170 | $header = (string) App::make('view')->make('emails.parts.order_header', $data); |