Make auto inline brand CSS for email layouts optional (#3192)
Fixes #3133. Credit to @TimFoerster. Thanks to all the reviewers from #3192.
This commit is contained in:
parent
a03a76ee52
commit
51d79ffaba
|
|
@ -176,7 +176,12 @@ class MailManager
|
|||
|
||||
$css = MailBrandSetting::renderCss();
|
||||
|
||||
$disableAutoInlineCss = false;
|
||||
|
||||
if ($template->layout) {
|
||||
|
||||
$disableAutoInlineCss = array_get($template->layout->options, 'disable_auto_inline_css', $disableAutoInlineCss);
|
||||
|
||||
$html = $this->renderTwig($template->layout->content_html, [
|
||||
'content' => $html,
|
||||
'css' => $template->layout->content_css,
|
||||
|
|
@ -186,7 +191,9 @@ class MailManager
|
|||
$css .= PHP_EOL . $template->layout->content_css;
|
||||
}
|
||||
|
||||
if (!$disableAutoInlineCss) {
|
||||
$html = (new CssToInlineStyles)->convert($html, $css);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
use October\Rain\Database\Schema\Blueprint;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class DbSystemMailLayoutsAddOptionsField extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('system_mail_layouts', function (Blueprint $table) {
|
||||
$table->text('options')->nullable()->after('is_locked');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('system_mail_layouts', function (Blueprint $table) {
|
||||
$table->dropColumn('options');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -129,6 +129,8 @@ return [
|
|||
'deleting_layout' => 'Lösche Layout...',
|
||||
'sending' => 'Sende Nachricht...',
|
||||
'return' => 'Zurück zur Vorlagen-Liste',
|
||||
'options' => 'Optionen',
|
||||
'disable_auto_inline_css' => 'Automtische inline CSS deaktivieren',
|
||||
],
|
||||
'install' => [
|
||||
'project_label' => 'Mit Projekt verbinden',
|
||||
|
|
|
|||
|
|
@ -237,7 +237,9 @@ return [
|
|||
'deleting' => 'Deleting Template...',
|
||||
'deleting_layout' => 'Deleting Layout...',
|
||||
'sending' => 'Sending test message...',
|
||||
'return' => 'Return to template list'
|
||||
'return' => 'Return to template list',
|
||||
'options' => 'Options',
|
||||
'disable_auto_inline_css' => 'Disable automatic inline CSS'
|
||||
],
|
||||
'mail_brand' => [
|
||||
'menu_label' => 'Mail branding',
|
||||
|
|
|
|||
|
|
@ -41,6 +41,13 @@ class MailLayout extends Model
|
|||
'content_html' => 'required',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array Options array
|
||||
*/
|
||||
protected $jsonable = [
|
||||
'options'
|
||||
];
|
||||
|
||||
public static $codeCache;
|
||||
|
||||
public function beforeDelete()
|
||||
|
|
@ -134,4 +141,5 @@ class MailLayout extends Model
|
|||
{
|
||||
return MailParser::parse(FileHelper::get(View::make($code)->getPath()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,3 +39,9 @@ secondaryTabs:
|
|||
size: giant
|
||||
tab: system::lang.mail_templates.content_text
|
||||
stretch: true
|
||||
|
||||
options[disable_auto_inline_css]:
|
||||
label: system::lang.mail_templates.disable_auto_inline_css
|
||||
type: checkbox
|
||||
tab: system::lang.mail_templates.options
|
||||
default: false
|
||||
|
|
|
|||
Loading…
Reference in New Issue