Uses full font-family name in element styles
This commit is contained in:
@ -41,6 +41,7 @@ class StylesHelper {
|
|||||||
static function getStyles($data, $type, $ignore_specific_styles = false) {
|
static function getStyles($data, $type, $ignore_specific_styles = false) {
|
||||||
$styles = array_map(function($attribute, $style) use ($ignore_specific_styles) {
|
$styles = array_map(function($attribute, $style) use ($ignore_specific_styles) {
|
||||||
if(!$ignore_specific_styles || !in_array($attribute, $ignore_specific_styles)) {
|
if(!$ignore_specific_styles || !in_array($attribute, $ignore_specific_styles)) {
|
||||||
|
$style = StylesHelper::applyFontFamily($attribute, $style);
|
||||||
return StylesHelper::translateCSSAttribute($attribute) . ': ' . $style . ' !important;';
|
return StylesHelper::translateCSSAttribute($attribute) . ': ' . $style . ' !important;';
|
||||||
}
|
}
|
||||||
}, array_keys($data[$type]), $data[$type]);
|
}, array_keys($data[$type]), $data[$type]);
|
||||||
|
@ -346,6 +346,18 @@ class RendererTest extends \MailPoetTest {
|
|||||||
)->equals(1);
|
)->equals(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testItUsesFullFontFamilyNameInElementStyles() {
|
||||||
|
$newsletter = $this->newsletter['body'];
|
||||||
|
$template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][5];
|
||||||
|
$template['styles']['block']['fontFamily'] = 'Lucida';
|
||||||
|
$DOM = $this->DOM_parser->parseStr(Button::render($template, $columnCount = 1));
|
||||||
|
expect(
|
||||||
|
preg_match(
|
||||||
|
'/font-family: \'Lucida Sans Unicode\', \'Lucida Grande\', sans-serif/',
|
||||||
|
$DOM('a.mailpoet_button', 0)->attr('style'))
|
||||||
|
)->equals(1);
|
||||||
|
}
|
||||||
|
|
||||||
function testItRendersSocialIcons() {
|
function testItRendersSocialIcons() {
|
||||||
$newsletter = $this->newsletter['body'];
|
$newsletter = $this->newsletter['body'];
|
||||||
$template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][6];
|
$template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][6];
|
||||||
|
Reference in New Issue
Block a user