Skip to content

Commit

Permalink
MailTemplate model is now translatable (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin authored May 21, 2023
1 parent 8356ec3 commit 7fd8a56
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use System\Classes\PluginBase;
use System\Classes\PluginManager;
use System\Models\File;
use System\Models\MailTemplate;
use Winter\Sitemap\Classes\DefinitionItem;
use Winter\Sitemap\Models\Definition;
use Winter\Translate\Classes\EventRegistry;
Expand Down Expand Up @@ -254,6 +255,10 @@ protected function extendSystemModule(): void
$this->extendModel($model, ['title', 'description']);
});

MailTemplate::extend(function ($model) {
$this->extendModel($model, ['subject', 'description', 'content_html', 'content_text']);
});

// Load localized version of mail templates (akin to localized CMS content files)
Event::listen('mailer.beforeAddContent', function ($mailer, $message, $view, $data, $raw, $plain) {
if (!empty($data['_current_locale'])) {
Expand Down

0 comments on commit 7fd8a56

Please sign in to comment.