ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\HomePage\Setup\Patch\Data;
|
||||
|
||||
use Magento\Cms\Model\BlockFactory;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
|
||||
class UpdateAnnouncementTicker implements DataPatchInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BlockFactory $blockFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(): self
|
||||
{
|
||||
$block = $this->blockFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', 'lts-home-announcement')
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if (!$block->getId()) {
|
||||
$block = $this->blockFactory->create()
|
||||
->setTitle('LTS Home - Top Announcement')
|
||||
->setIdentifier('lts-home-announcement')
|
||||
->setIsActive(true)
|
||||
->setStores([0]);
|
||||
}
|
||||
|
||||
$block->setContent($this->getContent())->save();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<div class="lts-announcement" role="region" aria-label="Store announcements" data-mage-init='{"Magento_Theme/js/lts-announcement":{"delay":3000,"duration":1200}}'>
|
||||
<div class="lts-announcement__inner">
|
||||
<div class="lts-announcement__viewport" aria-live="off">
|
||||
<div class="lts-announcement__track">
|
||||
<a class="lts-announcement__item is-active" href="{{store url='promotions'}}">LTS Summer Savings Event – Save up to 40%</a>
|
||||
<a class="lts-announcement__item" href="{{store url='products/4k'}}">Explore LTS 4K Security Solutions</a>
|
||||
<a class="lts-announcement__item" href="{{store url='customer/account/login'}}">Sign In For Dealer Pricing, Availability & Checkout</a>
|
||||
</div>
|
||||
</div>
|
||||
<span class="lts-announcement__links">
|
||||
<a href="{{store url='request-a-quote'}}">Request a Quote</a>
|
||||
<a href="{{store url='contacts'}}">Help</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [InstallHomePageContent::class];
|
||||
}
|
||||
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user