36 lines
888 B
PHP
36 lines
888 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Esun\Cart\Block;
|
|
|
|
use Esun\Cart\Model\TestModeConfig;
|
|
use Magento\Framework\Serialize\Serializer\Json;
|
|
use Magento\Framework\View\Element\Template;
|
|
|
|
class TestMode extends Template
|
|
{
|
|
public function __construct(
|
|
Template\Context $context,
|
|
private readonly TestModeConfig $testModeConfig,
|
|
private readonly Json $json,
|
|
array $data = []
|
|
) {
|
|
parent::__construct($context, $data);
|
|
}
|
|
|
|
public function isRestricted(): bool
|
|
{
|
|
return $this->testModeConfig->isRestricted();
|
|
}
|
|
|
|
public function getMageInitJson(): string
|
|
{
|
|
return $this->json->serialize([
|
|
'Esun_Cart/js/test-mode' => [
|
|
'title' => $this->testModeConfig->getPopupTitle(),
|
|
'message' => $this->testModeConfig->getPopupMessage(),
|
|
],
|
|
]);
|
|
}
|
|
}
|