Skip to content

Commit

Permalink
Merge pull request #5 from magefan/12113-add-mage-suite-product-tile-…
Browse files Browse the repository at this point in the history
…compatibility

12113 addede MageSuite ProductTile compatibility
  • Loading branch information
magefan authored Nov 1, 2024
2 parents 47200cc + a45783b commit f5bfd83
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Plugin/Frontend/MageSuite/ProductTile/Block/Tile/Container.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
/**
* Copyright © Magefan (support@magefan.com). All rights reserved.
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
*/

declare(strict_types=1);

namespace Magefan\ProductLabel\Plugin\Frontend\MageSuite\ProductTile\Block\Tile;

use Magefan\ProductLabel\Model\Config;
use Magefan\ProductLabel\Model\Parser\Html;

class Container
{
/**
* @var Config
*/
protected $config;

/**
* @param Config $config
*/
public function __construct(
Config $config
)
{
$this->config = $config;
}

/**
* @param $subject
* @param $result
* @return mixed|string
*/
public function afterToHtml($subject, $result)
{
if ($result && $this->config->isEnabled()) {
if ($subject->getData('html_tag') == 'figure') {
return $result. Html::COMMENT_PREFIX . $subject->getProduct()->getId() . Html::COMMENT_SUFFIX;
}
}

return $result;
}
}
4 changes: 4 additions & 0 deletions etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
<type name="Magento\Catalog\Block\Product\View\Gallery">
<plugin name="wrap_gallery_image_with_mf_comments" type="Magefan\ProductLabel\Plugin\Frontend\Magento\Catalog\Block\Product\View\Gallery" sortOrder="10" disabled="false"/>
</type>

<type name="MageSuite\ProductTile\Block\Tile\Container">
<plugin name="add_mf_comments_to_mage_suite_product_tile" type="Magefan\ProductLabel\Plugin\Frontend\MageSuite\ProductTile\Block\Tile\Container" sortOrder="10" disabled="false"/>
</type>
</config>

0 comments on commit f5bfd83

Please sign in to comment.