Skip to content

Commit

Permalink
12113 addede MageSuite ProductTile compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Bohdan Berezhniy committed Oct 28, 2024
1 parent 6983020 commit a45783b
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 a45783b

Please sign in to comment.