Files
esun3d/app/code/Esun/Cart/Model/Checkout/ServicesConfigProvider.php
T
2026-09-15 10:35:56 +08:00

36 lines
989 B
PHP

<?php
declare(strict_types=1);
namespace Esun\Cart\Model\Checkout;
use Magento\Checkout\Model\ConfigProviderInterface;
use Magento\Cms\Block\Block as CmsBlock;
use Magento\Framework\View\LayoutInterface;
class ServicesConfigProvider implements ConfigProviderInterface
{
private const PAYMENT_BLOCK = 'esun_product_payment_security';
private const DELIVERY_BLOCK = 'esun_product_delivery_shipping';
public function __construct(private readonly LayoutInterface $layout)
{
}
public function getConfig(): array
{
return [
'esunCartServices' => [
'paymentSecurity' => $this->renderCmsBlock(self::PAYMENT_BLOCK),
'deliveryShipping' => $this->renderCmsBlock(self::DELIVERY_BLOCK)
]
];
}
private function renderCmsBlock(string $identifier): string
{
return $this->layout->createBlock(CmsBlock::class)
->setBlockId($identifier)
->toHtml();
}
}