Always show product image in editor
[MAILPOET-1843]
This commit is contained in:
committed by
Rostislav Wolný
parent
b40e4bb28a
commit
6fd9c69a27
@@ -47,7 +47,14 @@ class PostTransformer {
|
|||||||
$featured_image = $this->getFeaturedImage($post);
|
$featured_image = $this->getFeaturedImage($post);
|
||||||
$featured_image_position = $this->args['featuredImagePosition'];
|
$featured_image_position = $this->args['featuredImagePosition'];
|
||||||
|
|
||||||
if ($featured_image && $featured_image_position === 'belowTitle' && $this->args['displayType'] === 'excerpt') {
|
if (
|
||||||
|
$featured_image
|
||||||
|
&& $featured_image_position === 'belowTitle'
|
||||||
|
&& (
|
||||||
|
$this->args['displayType'] === 'excerpt'
|
||||||
|
|| $this->isProduct($post)
|
||||||
|
)
|
||||||
|
) {
|
||||||
array_unshift($content, $title, $featured_image);
|
array_unshift($content, $title, $featured_image);
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
@@ -73,7 +80,14 @@ class PostTransformer {
|
|||||||
|
|
||||||
$featured_image_position = $this->args['featuredImagePosition'];
|
$featured_image_position = $this->args['featuredImagePosition'];
|
||||||
|
|
||||||
if (!$featured_image || $featured_image_position === 'none' || $this->args['displayType'] !== 'excerpt') {
|
if (
|
||||||
|
!$featured_image
|
||||||
|
|| $featured_image_position === 'none'
|
||||||
|
|| (
|
||||||
|
$this->args['displayType'] !== 'excerpt'
|
||||||
|
&& !$this->isProduct($post)
|
||||||
|
)
|
||||||
|
) {
|
||||||
array_unshift($content, $title);
|
array_unshift($content, $title);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
@@ -295,6 +309,10 @@ class PostTransformer {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function isProduct($post) {
|
||||||
|
return $post->post_type === 'product';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces double quote character with a unicode
|
* Replaces double quote character with a unicode
|
||||||
* alternative to avoid problems when inlining CSS.
|
* alternative to avoid problems when inlining CSS.
|
||||||
|
@@ -274,6 +274,7 @@ class PostContentTransformerTest extends \MailPoetTest {
|
|||||||
Mock::double($transformer, array('getContent' => $content));
|
Mock::double($transformer, array('getContent' => $content));
|
||||||
Mock::double($transformer, array('getFeaturedImage' => $image));
|
Mock::double($transformer, array('getFeaturedImage' => $image));
|
||||||
Mock::double($transformer, array('getTitle' => $title));
|
Mock::double($transformer, array('getTitle' => $title));
|
||||||
|
Mock::double($transformer, array('isProduct' => false));
|
||||||
return $transformer;
|
return $transformer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user