From 55dd1d0ab0fd1db272e3c03ece42cb6b68feff14 Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Tue, 16 Jan 2024 16:29:10 +0100 Subject: [PATCH] Improve getTheme to return merged core theme + email theme The idea is that the core theme is a base and we add email-specific modifications on top of and create a core email theme. [MAILPOET-5740] --- mailpoet/lib/EmailEditor/Engine/SettingsController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mailpoet/lib/EmailEditor/Engine/SettingsController.php b/mailpoet/lib/EmailEditor/Engine/SettingsController.php index f2ca6170b8..68fd571aba 100644 --- a/mailpoet/lib/EmailEditor/Engine/SettingsController.php +++ b/mailpoet/lib/EmailEditor/Engine/SettingsController.php @@ -184,10 +184,12 @@ class SettingsController { } public function getTheme(): \WP_Theme_JSON { + $coreThemeData = \WP_Theme_JSON_Resolver::get_core_data(); $themeJson = (string)file_get_contents(dirname(__FILE__) . '/theme.json'); $themeJson = json_decode($themeJson, true); /** @var array $themeJson */ - return new \WP_Theme_JSON($themeJson); + $coreThemeData->merge(new \WP_Theme_JSON($themeJson, 'default')); + return $coreThemeData; } public function getStylesheetForRendering(): string { @@ -195,7 +197,7 @@ class SettingsController { $emailThemeSettings = $this->getTheme()->get_settings(); $css = ''; // Font family classes - foreach ($emailThemeSettings['typography']['fontFamilies']['theme'] as $fontFamily) { + foreach ($emailThemeSettings['typography']['fontFamilies']['default'] as $fontFamily) { $css .= ".has-{$fontFamily['slug']}-font-family { font-family: {$fontFamily['fontFamily']}; } \n"; } // Font size classes