Files

132 lines
5.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 CreateFooterBlocks implements DataPatchInterface
{
public function __construct(
private readonly BlockFactory $blockFactory
) {
}
public function apply(): self
{
$this->saveBlock(
'lts-footer-link-columns',
'LTS Footer - Link Columns',
$this->getLinkColumnsContent()
);
$this->saveBlock(
'lts-footer-social-app',
'LTS Footer - Social And Mobile App',
$this->getSocialAppContent()
);
return $this;
}
private function saveBlock(string $identifier, string $title, string $content): void
{
$block = $this->blockFactory->create()->getCollection()
->addFieldToFilter('identifier', $identifier)
->setPageSize(1)
->getFirstItem();
if (!$block->getId()) {
$block = $this->blockFactory->create();
}
$block->setTitle($title)
->setIdentifier($identifier)
->setContent($content)
->setIsActive(true)
->setStores([0])
->save();
}
private function getLinkColumnsContent(): string
{
return <<<'HTML'
<nav class="lts-footer-links" aria-label="Footer navigation">
<div class="lts-footer-links__column">
<h2>Support</h2>
<a href="{{store url='downloads'}}">Downloads</a>
<a href="https://ltsecurityinc.zendesk.com/" target="_blank" rel="noopener">Knowledge Base</a>
<a href="{{store url='tools'}}">Tools</a>
<a href="https://ns1.dvrlists.com/" target="_blank" rel="noopener">DDNS</a>
<a href="{{store url='rma'}}">RMA Form</a>
</div>
<div class="lts-footer-links__column">
<h2>Resources</h2>
<a href="{{store url='solutions'}}">Solutions</a>
<a href="{{store url='events'}}">Event</a>
<a href="{{store url='flyers'}}">Flyers</a>
<a href="{{store url='newsletter'}}">Newsletter</a>
<a href="{{store url='blog'}}">Blog</a>
<a href="https://www.youtube.com/@LTSCCTV/" target="_blank" rel="noopener">Videos</a>
<a href="{{store url='customer-testimonials'}}">Customer Testimonials</a>
</div>
<div class="lts-footer-links__column">
<h2>Partners</h2>
<a href="{{store url='project-registration'}}">Project Registration</a>
<a href="{{store url='technology-partners'}}">Technology Partners</a>
<a href="{{store url='international-partners'}}">International Partners</a>
</div>
<div class="lts-footer-links__column">
<h2>Company</h2>
<a href="{{store url='about-lts'}}">About LTS</a>
<a href="{{store url='contacts'}}">Contact Us</a>
</div>
<div class="lts-footer-links__column lts-footer-links__column--legal">
<h2>Legal &amp; Compliance</h2>
<a href="{{store url='sla'}}">Software License Agreement</a>
<a href="{{store url='terms-of-use'}}">Terms Of Use</a>
<a href="{{store url='privacy-policy'}}">Privacy Policy</a>
<a href="{{store url='terms-and-Conditions'}}">Terms And Conditions</a>
</div>
</nav>
HTML;
}
private function getSocialAppContent(): string
{
return <<<'HTML'
<div class="lts-footer-app-block">
<div class="lts-footer-app-block__download">
<p>Download<br>The LTS<br>Mobile App</p>
<a href="https://ltsecurityinc.com/" target="_blank" rel="noopener" aria-label="Open LTS website">
<img src="{{view url='Magento_Theme::images/lts-footer/mobile-app-qr.png'}}" alt="QR code for the LTS website">
</a>
</div>
<div class="lts-footer-phone" aria-hidden="true">
<span class="lts-footer-phone__speaker"></span>
<span class="lts-footer-phone__screen">
<img src="{{view url='Magento_Theme::images/lts-home-v2/pro-x.png'}}" alt="">
</span>
</div>
<div class="lts-footer-social" aria-label="LTS social media">
<a href="https://www.facebook.com/CCTV.LTS/" target="_blank" rel="noopener" aria-label="Facebook"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><path d="M16 25V15h3.3l.5-4H16V8.5c0-1.2.4-2 2-2h2.1V3a28 28 0 0 0-3.1-.2c-3.1 0-5.2 1.9-5.2 5.4V11H8.3v4h3.5v10"></path></svg></a>
<a href="https://www.instagram.com/ltsecurityinc/" target="_blank" rel="noopener" aria-label="Instagram"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><rect x="6" y="6" width="16" height="16" rx="5"></rect><circle cx="14" cy="14" r="4"></circle><circle cx="19.5" cy="8.7" r="1"></circle></svg></a>
<a href="https://twitter.com/LTSecurityinc" target="_blank" rel="noopener" aria-label="X"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><path d="M7 6l14 16M21 6 7 22"></path></svg></a>
<a href="https://www.youtube.com/@LTSCCTV/" target="_blank" rel="noopener" aria-label="YouTube"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><rect x="5" y="8" width="18" height="12" rx="3"></rect><path d="m12 11 6 3-6 3z"></path></svg></a>
<a href="https://www.linkedin.com/company/ltsecurityinc/" target="_blank" rel="noopener" aria-label="LinkedIn"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><circle cx="8.5" cy="9" r="1.4"></circle><path d="M7 12v9M12 21v-9m0 4c0-2.5 1.5-4 3.8-4 2.8 0 4.2 1.8 4.2 5v4"></path></svg></a>
</div>
</div>
HTML;
}
public static function getDependencies(): array
{
return [CreateShopByCategoryBlock::class];
}
public function getAliases(): array
{
return [];
}
}