Inline style declaration from font-size classes

This is needed for cases where we don't touch the HTML output
to insert font size from the preprocessor (e.g., list item)
[MAILPOET-5740]
This commit is contained in:
Rostislav Wolny
2024-01-16 15:39:22 +01:00
committed by Jan Lysý
parent daf2d9f854
commit 0e04a892c2
2 changed files with 13 additions and 3 deletions

View File

@@ -191,12 +191,17 @@ class SettingsController {
}
public function getStylesheetForRendering(): string {
$settings = $this->getTheme()->get_settings();
$coreThemeSettings = \WP_Theme_JSON_Resolver::get_core_data()->get_settings();
$emailThemeSettings = $this->getTheme()->get_settings();
$css = '';
// Font family classes
foreach ($settings['typography']['fontFamilies']['theme'] as $fontFamily) {
foreach ($emailThemeSettings['typography']['fontFamilies']['theme'] as $fontFamily) {
$css .= ".has-{$fontFamily['slug']}-font-family { font-family: {$fontFamily['fontFamily']}; } \n";
}
// Font size classes
foreach ($coreThemeSettings['typography']['fontSizes']['default'] as $fontSize) {
$css .= ".has-{$fontSize['slug']}-font-size { font-size: {$fontSize['size']}; } \n";
}
return $css;
}