Skip to content

Commit ff4840e

Browse files
author
Eric Bohanon
committed
MAGETWO-71257: Need to disable module output by configuration
1 parent 5d1c9a2 commit ff4840e

File tree

4 files changed

+9
-16
lines changed

4 files changed

+9
-16
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@deprecated Magento does not support custom disabling/enabling modules output since 2.2.0 version.
2121
Section 'Advanced' was disabled. This section will be removed from code in one release.
2222
-->
23-
<section id="advanced" translate="label" type="text" sortOrder="910" showInDefault="0" showInWebsite="0" showInStore="0">
23+
<section id="advanced" translate="label" type="text" sortOrder="910" showInDefault="1" showInWebsite="1" showInStore="1">
2424
<label>Advanced</label>
2525
<tab>advanced</tab>
2626
<resource>Magento_Backend::advanced</resource>

app/code/Magento/Config/Test/Unit/Block/System/Config/Form/Fieldset/Modules/DisableOutputTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
/**
99
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
10-
* @deprecated because \Magento\Config\Block\System\Config\Form\Fieldset\Modules\DisableOutput is deprecated
1110
*/
1211
class DisableOutputTest extends \PHPUnit\Framework\TestCase
1312
{

lib/internal/Magento/Framework/Module/Manager.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ class Manager
2121
{
2222
/**
2323
* @var Output\ConfigInterface
24-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version.
25-
* The property can be removed in a future major release
2624
*/
2725
private $_outputConfig;
2826

@@ -33,8 +31,6 @@ class Manager
3331

3432
/**
3533
* @var array
36-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version.
37-
* The property can be removed in a future major release
3834
*/
3935
private $_outputConfigPaths;
4036

@@ -69,14 +65,18 @@ public function isEnabled($moduleName)
6965
*
7066
* @param string $moduleName Fully-qualified module name
7167
* @return boolean
72-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
7368
*/
7469
public function isOutputEnabled($moduleName)
7570
{
7671
if (!$this->isEnabled($moduleName)) {
7772
return false;
7873
}
79-
74+
if (!$this->_isCustomOutputConfigEnabled($moduleName)) {
75+
return false;
76+
}
77+
if ($this->_outputConfig->isEnabled($moduleName)) {
78+
return false;
79+
}
8080
return true;
8181
}
8282

@@ -85,7 +85,6 @@ public function isOutputEnabled($moduleName)
8585
*
8686
* @param string $moduleName Fully-qualified module name
8787
* @return boolean
88-
* @deprecated
8988
*/
9089
protected function _isCustomOutputConfigEnabled($moduleName)
9190
{

lib/internal/Magento/Framework/Module/Output/Config.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
*/
88
namespace Magento\Framework\Module\Output;
99

10-
/**
11-
* Checks whether the module is enabled in the configuration.
12-
*
13-
* @deprecated 100.2.0 Magento does not support custom disabling/enabling module output since 2.2.0 version
14-
*/
1510
class Config implements \Magento\Framework\Module\Output\ConfigInterface
1611
{
1712
/**
@@ -53,7 +48,7 @@ public function __construct(
5348
*/
5449
public function isEnabled($moduleName)
5550
{
56-
return false;
51+
return $this->isSetFlag(sprintf(self::XML_PATH_MODULE_OUTPUT_STATUS, $moduleName));
5752
}
5853

5954
/**
@@ -65,6 +60,6 @@ public function isEnabled($moduleName)
6560
*/
6661
public function isSetFlag($path)
6762
{
68-
return false;
63+
return $this->_scopeConfig->isSetFlag($path, $this->_storeType);
6964
}
7065
}

0 commit comments

Comments
 (0)