In Magento, We can check any module is to enable or disable using a simple code snippet.
Call Magento\Framework\Module\Manager class to__construct() for check module status.
isEnabled() module used to display the result of the Module Enable or Disable with the boolean value true/false.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <?php namespace Rbj\Training\Block; class Modulemanager extends \Magento\Framework\View\Element\Template { protected $_moduleManager; public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Module\Manager $moduleManager, array $data = [] ) { $this->_moduleManager = $moduleManager; parent::__construct($context, $data); } /* return bool */ public function isModuleEnable() { return $this->_moduleManager->isEnabled('Magento_Review'); } } |
Call from template,
$isEnable = $block->isModuleEnable();