Skip to content

Commit f5bfd83

Browse files
authored
Merge pull request #5 from magefan/12113-add-mage-suite-product-tile-compatibility
12113 addede MageSuite ProductTile compatibility
2 parents 47200cc + a45783b commit f5bfd83

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
/**
3+
* Copyright © Magefan (support@magefan.com). All rights reserved.
4+
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magefan\ProductLabel\Plugin\Frontend\MageSuite\ProductTile\Block\Tile;
10+
11+
use Magefan\ProductLabel\Model\Config;
12+
use Magefan\ProductLabel\Model\Parser\Html;
13+
14+
class Container
15+
{
16+
/**
17+
* @var Config
18+
*/
19+
protected $config;
20+
21+
/**
22+
* @param Config $config
23+
*/
24+
public function __construct(
25+
Config $config
26+
)
27+
{
28+
$this->config = $config;
29+
}
30+
31+
/**
32+
* @param $subject
33+
* @param $result
34+
* @return mixed|string
35+
*/
36+
public function afterToHtml($subject, $result)
37+
{
38+
if ($result && $this->config->isEnabled()) {
39+
if ($subject->getData('html_tag') == 'figure') {
40+
return $result. Html::COMMENT_PREFIX . $subject->getProduct()->getId() . Html::COMMENT_SUFFIX;
41+
}
42+
}
43+
44+
return $result;
45+
}
46+
}

etc/frontend/di.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
<type name="Magento\Catalog\Block\Product\View\Gallery">
1717
<plugin name="wrap_gallery_image_with_mf_comments" type="Magefan\ProductLabel\Plugin\Frontend\Magento\Catalog\Block\Product\View\Gallery" sortOrder="10" disabled="false"/>
1818
</type>
19+
20+
<type name="MageSuite\ProductTile\Block\Tile\Container">
21+
<plugin name="add_mf_comments_to_mage_suite_product_tile" type="Magefan\ProductLabel\Plugin\Frontend\MageSuite\ProductTile\Block\Tile\Container" sortOrder="10" disabled="false"/>
22+
</type>
1923
</config>

0 commit comments

Comments
 (0)