Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
12965-Custom-System-Seaction-for-Bundle-Product
  • Loading branch information
ivanhrytsaim committed Mar 7, 2025
commit da4ce01b37f4d418c139e94d64c352cf56457a3a
2 changes: 1 addition & 1 deletion Block/Adminhtml/System/Config/Form/CacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele
$planText = (!$this->getModuleVersion->execute($this->getModuleName() . $this->getMinPlan()))
? __('To enable <strong>Page Cache Warmer</strong> please update to %1 or install %2.',
'<a href="#"><strong>Page Speed Optimization Extra</strong></a>',
'<a rel="noopener" target="_blank" href="https://magefan.com/magento-2-page-cache-warmer"><strong>Magento 2 Page Cache Warmer</strong></a>')
'<a rel="noopener" target="_blank" href="https://magefan.com/magento-2-full-page-cache-warmer"><strong>Magento 2 Page Cache Warmer</strong></a>')
: __('To enable <strong>Page Cache Warmer</strong> please navigate to')
. '<a href="' . $this->escapeHtml($this->getUrl('*/*/*', ['section' => 'mfpagecachewarmer'])) . '" target="_blank"> <strong>Stores > Configuration > Magefan Extensions > Cache Warmer</strong></a>.';

Expand Down
10 changes: 10 additions & 0 deletions Observer/AdminSystemConfigChangedSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace Magefan\SpeedOptimization\Observer;

use Magefan\Community\Model\SystemConfigAutoKeyManager;
use Magefan\SpeedOptimization\Model\Config;
use Magento\Config\Model\Config\Structure\Element\Field;
use Magento\Config\Model\Config\Structure\Element\Group;
Expand Down Expand Up @@ -125,6 +126,8 @@ class AdminSystemConfigChangedSection implements ObserverInterface
*/
private $config;

private $autoKeyManager;

/**
* @param ScopeConfigInterface $scopeConfig
* @param ConfigLoader $configLoader
Expand All @@ -135,6 +138,7 @@ class AdminSystemConfigChangedSection implements ObserverInterface
* @param MagentoConfig $magentoConfig
* @param ReinitableConfigInterface $appConfig
* @param Config $config
* @param Magefan\Community\Model\SystemConfigAutoKeyManager $autoKeyManager
* @param SettingChecker|null $settingChecker
*/
public function __construct(
Expand All @@ -147,6 +151,7 @@ public function __construct(
MagentoConfig $magentoConfig,
ReinitableConfigInterface $appConfig,
Config $config,
SystemConfigAutoKeyManager $autoKeyManager,
SettingChecker $settingChecker = null
) {
$this->scopeConfig = $scopeConfig;
Expand All @@ -158,6 +163,7 @@ public function __construct(
$this->magentoConfig = $magentoConfig;
$this->appConfig = $appConfig;
$this->config = $config;
$this->autoKeyManager = $autoKeyManager;
$this->settingChecker = $settingChecker ?: ObjectManager::getInstance()->get(SettingChecker::class);
}

Expand All @@ -179,6 +185,10 @@ public function execute(Observer $observer)

$groups = $this->scopeConfig->getValue('mfspeedoptimizations', $this->scope, $this->scopeCode);

if (isset($groups['general']['key'])) {
$this->autoKeyManager->execute('mfspeedoptimizations', $groups['general']['key']);
}

if (!isset($groups['css'])) {
return;
}
Expand Down
19 changes: 19 additions & 0 deletions etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" ?>
<!--
/**
* Copyright © Magefan ([email protected]). All rights reserved.
* Please visit Magefan.com for license details (https://magefan.com/end-user-license-agreement).
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="Magefan\Community\Model\ModulePool">
<arguments>
<argument name="modules" xsi:type="array">
<item name="mfspeedoptimizations" xsi:type="array">
<item name="base" xsi:type="string">mfrocketjavascript, mflazyzoad</item>
</item>
</argument>
</arguments>
</type>
</config>
2 changes: 1 addition & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<section id="mfspeedoptimizations" translate="label" type="text" sortOrder="10423249090" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
<class>mfspeedoptimizations</class>
<label>Page Speed Optimization</label>
<tab>magefan</tab>
<resource>Magefan_SpeedOptimization::config_section</resource>
Expand Down