Files

63 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace Lts\HomePage\Setup\Patch\Data;
use Magento\Cms\Model\BlockFactory;
use Magento\Framework\Setup\Patch\DataPatchInterface;
class UpdateDealerPricingBlock implements DataPatchInterface
{
public function __construct(
private readonly BlockFactory $blockFactory
) {
}
public function apply(): self
{
$block = $this->blockFactory->create()->getCollection()
->addFieldToFilter('identifier', 'lts-home-dealer-pricing')
->setPageSize(1)
->getFirstItem();
if ($block->getId()) {
$block->setContent($this->getContent())->save();
}
return $this;
}
private function getContent(): string
{
return <<<'HTML'
<section class="lts-dealer" aria-labelledby="lts-dealer-title">
<div class="lts-dealer__icon" aria-hidden="true">
<img src="{{view url='Magento_Theme::images/lts-home-v2/dealer-sign-in.png'}}" alt="">
</div>
<div class="lts-dealer__content">
<h2 id="lts-dealer-title">Sign In For Dealer Pricing</h2>
<p>Unlock Dealer Pricing, Availability, And Checkout.</p>
<div class="lts-dealer__actions">
<a class="lts-dealer__button" href="{{store url='customer/account/login'}}">Sign In</a>
<span class="lts-dealer__divider" aria-hidden="true"></span>
<div class="lts-dealer__new">
<span>New To LTS?</span>
<a href="{{store url='customer/account/create'}}">Become A Customer Today <span aria-hidden="true">&longrightarrow;</span></a>
</div>
</div>
</div>
</section>
HTML;
}
public static function getDependencies(): array
{
return [InstallHomePageContent::class];
}
public function getAliases(): array
{
return [];
}
}