- Adds tests for newsletter renderer

This commit is contained in:
MrCasual
2015-09-23 22:42:11 -04:00
parent b3e376cd01
commit a2494cfa1b
3 changed files with 136 additions and 4 deletions

View File

@@ -15,17 +15,19 @@ class StylesHelper {
'lineHeight' => 'line-height'
);
function getBlockStyles($element) {
function getBlockStyles($element, $ignoreSpecificStyles = false) {
if(!isset($element['styles']['block'])) {
return;
}
return $this->getStyles($element['styles'], 'block');
return $this->getStyles($element['styles'], 'block', $ignoreSpecificStyles);
}
function getStyles($data, $type) {
$styles = array_map(function ($attribute, $style) {
function getStyles($data, $type, $ignoreSpecificStyles = false) {
$styles = array_map(function ($attribute, $style) use($ignoreSpecificStyles) {
if(!$ignoreSpecificStyles || !in_array($attribute, $ignoreSpecificStyles)) {
return $this->translateCSSAttribute($attribute) . ': ' . $style . ' !important;';
}
}, array_keys($data[$type]), $data[$type]);
return implode('', $styles);