Skip to content

Commit 2c9bd85

Browse files
committed
Check if Magefan_Blog installed
1 parent 7359819 commit 2c9bd85

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Model/Config.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
namespace Magefan\HtmlSitemap\Model;
1212

1313
use Magento\Framework\App\Config\ScopeConfigInterface;
14+
use Magento\Framework\Module\ModuleListInterface;
1415
use Magento\Store\Model\ScopeInterface;
1516

1617
class Config
@@ -56,13 +57,21 @@ class Config
5657
private $ignoredLinks;
5758

5859
/**
59-
* Config constructor.
60+
* @var ModuleListInterface
61+
*/
62+
private $moduleList;
63+
64+
/**
6065
* @param ScopeConfigInterface $scopeConfig
66+
* @param ModuleListInterface|null $moduleList
6167
*/
6268
public function __construct(
63-
ScopeConfigInterface $scopeConfig
69+
ScopeConfigInterface $scopeConfig,
70+
ModuleListInterface $moduleList = null
6471
) {
6572
$this->scopeConfig = $scopeConfig;
73+
$this->moduleList = $moduleList ?: \Magento\Framework\App\ObjectManager::getInstance()
74+
->get(ModuleListInterface::class);
6675
}
6776

6877
/**
@@ -131,7 +140,8 @@ public function getIgnoredLinks($storeId = null, $toUrlKeys = true)
131140
*/
132141
public function isBlogEnabled($storeId = null)
133142
{
134-
return (bool)$this->getConfig(self::XML_PATH_BLOG_EXTENSION_ENABLED, $storeId);
143+
return $this->getConfig(self::XML_PATH_BLOG_EXTENSION_ENABLED, $storeId)
144+
&& $this->moduleList->getOne('Magefan_Blog');
135145
}
136146

137147
/**

0 commit comments

Comments
 (0)