ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Hide Price (Call for Price) for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\HidePrice\Block\Adminhtml\System\Config;
|
||||
|
||||
use Magento\Framework\Data\Form\Element\AbstractElement;
|
||||
use Magento\Framework\Module\ModuleListInterface;
|
||||
|
||||
class Information extends \Magento\Config\Block\System\Config\Form\Fieldset
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $userGuide = 'https://amasty.com/docs/doku.php?id=magento_2:hide_price';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $enemyExtensions = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* @var ModuleListInterface
|
||||
*/
|
||||
private $moduleList;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Backend\Block\Context $context,
|
||||
\Magento\Backend\Model\Auth\Session $authSession,
|
||||
\Magento\Framework\View\Helper\Js $jsHelper,
|
||||
ModuleListInterface $moduleList,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $authSession, $jsHelper, $data);
|
||||
$this->moduleList = $moduleList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render fieldset html
|
||||
*
|
||||
* @param AbstractElement $element
|
||||
* @return string
|
||||
*/
|
||||
public function render(AbstractElement $element)
|
||||
{
|
||||
$html = $this->_getHeaderHtml($element);
|
||||
|
||||
$this->setContent(__('Please update Amasty Base module. Re-upload it and replace all the files.'));
|
||||
|
||||
$this->_eventManager->dispatch(
|
||||
'amasty_base_add_information_content',
|
||||
['block' => $this]
|
||||
);
|
||||
|
||||
$html .= $this->getContent();
|
||||
$html .= $this->_getFooterHtml($element);
|
||||
|
||||
$html = str_replace(
|
||||
'amasty_information]" type="hidden" value="0"',
|
||||
'amasty_information]" type="hidden" value="1"',
|
||||
$html
|
||||
);
|
||||
$html = preg_replace('(onclick=\"Fieldset.toggleCollapse.*?\")', '', $html);
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|string
|
||||
*/
|
||||
public function getAdditionalModuleContent()
|
||||
{
|
||||
$result = '';
|
||||
if (!class_exists(\Zend_Dom_Query::class)
|
||||
&& !class_exists(\Zend\Dom\Query::class)
|
||||
&& !class_exists(\Laminas\Dom\Query::class)
|
||||
) {
|
||||
$message = [
|
||||
'type' => 'message-error',
|
||||
'text' => __(
|
||||
'Laminas DOM package is not installed (The package is required for hiding "Add to Cart" '
|
||||
. 'button on Category Page). Please, run the following command in the SSH: composer require '
|
||||
. 'laminas/laminas-dom'
|
||||
)
|
||||
];
|
||||
|
||||
if ($this->getBaseVersion() < '1.3.4') {
|
||||
return $message['text'];
|
||||
}
|
||||
|
||||
$result = [];
|
||||
$result[] = $message;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserGuide()
|
||||
{
|
||||
return $this->userGuide;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $userGuide
|
||||
*/
|
||||
public function setUserGuide($userGuide)
|
||||
{
|
||||
$this->userGuide = $userGuide;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getEnemyExtensions()
|
||||
{
|
||||
return $this->enemyExtensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $enemyExtensions
|
||||
*/
|
||||
public function setEnemyExtensions($enemyExtensions)
|
||||
{
|
||||
$this->enemyExtensions = $enemyExtensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
private function getBaseVersion()
|
||||
{
|
||||
$version = '';
|
||||
if (isset($this->moduleList->getOne('Amasty_Base')['setup_version'])) {
|
||||
$version = $this->moduleList->getOne('Amasty_Base')['setup_version'];
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user