Skip to content

Commit 3f43dfe

Browse files
committed
Add a module manager to the Magento Framework API
1 parent f710f9b commit 3f43dfe

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

app/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<preference for="Magento\Framework\Config\CacheInterface" type="Magento\Framework\App\Cache\Type\Config" />
6565
<preference for="Magento\Framework\Config\ValidationStateInterface" type="Magento\Framework\App\Arguments\ValidationState" />
6666
<preference for="Magento\Framework\Module\ModuleListInterface" type="Magento\Framework\Module\ModuleList" />
67+
<preference for="Magento\Framework\Module\ModuleManagerInterface" type="Magento\Framework\Module\Manager" />
6768
<preference for="Magento\Framework\Component\ComponentRegistrarInterface" type="Magento\Framework\Component\ComponentRegistrar"/>
6869
<preference for="Magento\Framework\Event\ConfigInterface" type="Magento\Framework\Event\Config" />
6970
<preference for="Magento\Framework\Event\InvokerInterface" type="Magento\Framework\Event\Invoker\InvokerDefault" />

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@
1010
namespace Magento\Framework\Module;
1111

1212
/**
13-
* Module status manager.
14-
*
15-
* Usage:
16-
* ```php
17-
* $manager->isEnabled('Vendor_Module');
18-
* ```
13+
* @inheritdoc
1914
*/
20-
class Manager
15+
class Manager implements ModuleManagerInterface
2116
{
2217
/**
2318
* @var Output\ConfigInterface
@@ -52,10 +47,7 @@ public function __construct(
5247
}
5348

5449
/**
55-
* Whether a module is enabled in the configuration or not
56-
*
57-
* @param string $moduleName Fully-qualified module name
58-
* @return boolean
50+
* @inheritdoc
5951
*/
6052
public function isEnabled($moduleName)
6153
{
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Magento\Framework\Module;
4+
5+
/**
6+
* Module status manager
7+
*
8+
* Usage:
9+
* ```php
10+
* $manager->isEnabled('Vendor_Module');
11+
* ```
12+
*
13+
* @api
14+
*/
15+
interface ModuleManagerInterface
16+
{
17+
/**
18+
* Retrieve whether or not a module is enabled by configuration
19+
*
20+
* @param string $moduleName Fully-qualified module name, e.g. Magento_Config
21+
* @return boolean Whether or not the module is enabled in the configuration
22+
*/
23+
public function isEnabled($moduleName);
24+
}

0 commit comments

Comments
 (0)