ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Plumrocket_GlobalPrivacyControl
|
||||
* @copyright Copyright (c) 2025 Plumrocket Inc.
|
||||
* @license https://plumrocket.com/license End-user License Agreement
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Plumrocket\GlobalPrivacyControl\ViewModel;
|
||||
|
||||
use Magento\Framework\Escaper;
|
||||
use Magento\Framework\View\Element\Block\ArgumentInterface;
|
||||
use Plumrocket\GlobalPrivacyControl\Helper\Config\OptOutNotification as OptOutNotificationConfig;
|
||||
|
||||
class OptOutNotification implements ArgumentInterface
|
||||
{
|
||||
/**
|
||||
* @var \Plumrocket\GlobalPrivacyControl\Helper\Config\OptOutNotification
|
||||
*/
|
||||
private $optOutNotificationConfig;
|
||||
|
||||
/**
|
||||
* @var \Magento\Framework\Escaper
|
||||
*/
|
||||
private $escaper;
|
||||
|
||||
/**
|
||||
* @param \Plumrocket\GlobalPrivacyControl\Helper\Config\OptOutNotification $optOutNotificationConfig
|
||||
* @param \Magento\Framework\Escaper $escaper
|
||||
*/
|
||||
public function __construct(
|
||||
OptOutNotificationConfig $optOutNotificationConfig,
|
||||
Escaper $escaper
|
||||
) {
|
||||
$this->optOutNotificationConfig = $optOutNotificationConfig;
|
||||
$this->escaper = $escaper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->optOutNotificationConfig->isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $escapeForJs
|
||||
* @return string
|
||||
*/
|
||||
public function getNotificationHtml(bool $escapeForJs = false): string
|
||||
{
|
||||
$html = <<<HTML
|
||||
<div class="pr-gpc-notification-wrap">
|
||||
{$this->optOutNotificationConfig->getNotificationText()}
|
||||
</div>
|
||||
HTML;
|
||||
return $escapeForJs
|
||||
? $this->escaper->escapeJs($html)
|
||||
: $html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user