$moduleId = 5; if (JModuleHelper::isEnabled('mod_custom', $moduleId)) { // code to render the module } else { // code to handle disabled module }
if (JModuleHelper::isEnabled('mod_custom')) { // code to render the module } else { // code to handle disabled module }This code checks whether any module of the mod_custom type is enabled. If there is at least one enabled module of this type, the code to render the module will be executed, otherwise the code to handle the disabled module will be executed. Package library: Joomla\CMS\Helper\ModuleHelper