Skip to content

Magento 2 How to disable module using xml file?

I am facing issue to create module. I created one module and I given apply to system admin to enable disable.
So, Right now I am doing module hide/show using below code.

$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$module_enable = $objectManager->get('MagentoFrameworkAppConfigScopeConfigInterface')->getValue('magefilter/magefilter/enable');
if(isset($module_enable) && $module_enable==1){

but is there any way if I can disable module from admin then it is disable by xml file.

I means is there any way to not ovverride that xml.

Thanks