Always show product image in editor

[MAILPOET-1843]
This commit is contained in:
Ján Mikláš
2019-04-02 13:46:52 +02:00
committed by Rostislav Wolný
parent b40e4bb28a
commit 6fd9c69a27
2 changed files with 21 additions and 2 deletions

View File

@@ -47,7 +47,14 @@ class PostTransformer {
$featured_image = $this->getFeaturedImage($post);
$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);
return $content;
}
@@ -73,7 +80,14 @@ class PostTransformer {
$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);
return array(
@@ -295,6 +309,10 @@ class PostTransformer {
);
}
private function isProduct($post) {
return $post->post_type === 'product';
}
/**
* Replaces double quote character with a unicode
* alternative to avoid problems when inlining CSS.

View File

@@ -274,6 +274,7 @@ class PostContentTransformerTest extends \MailPoetTest {
Mock::double($transformer, array('getContent' => $content));
Mock::double($transformer, array('getFeaturedImage' => $image));
Mock::double($transformer, array('getTitle' => $title));
Mock::double($transformer, array('isProduct' => false));
return $transformer;
}