-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
12113 addede MageSuite ProductTile compatibility
- Loading branch information
Bohdan Berezhniy
committed
Oct 28, 2024
1 parent
6983020
commit a45783b
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
Plugin/Frontend/MageSuite/ProductTile/Block/Tile/Container.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters