init
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user