![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/amasty/base/Plugin/Backend/Model/Config/ |
<?php declare(strict_types=1); /** * @author Amasty Team * @copyright Copyright (c) Amasty (https://www.amasty.com) * @package Magento 2 Base Package */ namespace Amasty\Base\Plugin\Backend\Model\Config; use Amasty\Base\Block\Adminhtml\System\Config\Information; use Magento\Config\Model\Config\ScopeDefiner; use Magento\Config\Model\Config\Structure; use Magento\Config\Model\Config\StructureElementInterface; class AddInformationBlockPlugin { /** * @var ScopeDefiner */ private $scopeDefiner; public function __construct( ScopeDefiner $scopeDefiner ) { $this->scopeDefiner = $scopeDefiner; } public function afterGetElementByPathParts( Structure $subject, StructureElementInterface $result ): StructureElementInterface { $moduleSection = $result->getData(); if (!isset($moduleSection['tab']) || $moduleSection['tab'] !== StructurePlugin::AMASTY_TAB_NAME || !isset($moduleSection['resource']) ) { return $result; } $moduleChildes = &$moduleSection['children']; if (isset($moduleChildes['amasty_information'])) { return $result; //backward compatibility } $moduleCode = strtok($moduleSection['resource'], '::'); $moduleChildes = [ 'amasty_information' => [ 'id' => 'amasty_information', 'translate' => 'label', 'type' => 'text', 'sortOrder' => '1', 'showInDefault' => '1', 'showInWebsite' => '1', 'showInStore' => '1', 'label' => 'Information', 'frontend_model' => Information::class, '_elementType' => 'group', 'path' => $moduleSection['id'] ?? '', 'module_code' => $moduleCode ] ] + $moduleChildes; $result->setData($moduleSection, $this->scopeDefiner->getScope()); return $result; } }