I want to perform some action when my custom module gets disable. Is there any observer event or plugin event that being fired when i disable my module?
Any help would be appreciated.
Thank you,
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI want to perform some action when my custom module gets disable. Is there any observer event or plugin event that being fired when i disable my module?
Any help would be appreciated.
Thank you,
For that purpose you can create the Recurring script and use Magento\Framework\Module\Manager
to check your module.
All recurring scripts executing are during each launch of the setup:upgrade command. Or you can use any other event to make changes.
Code will be something like this:
// Initialize module manager
public function __construct(
...
\Magento\Framework\Module\Manager $moduleManager,
....
) {
...
$this->moduleManager = $moduleManager;
...
}
And then check if modules enabled:
if ($this->moduleManager->isEnabled('Vendor_Module')) {
//the module is enabled
} else {
//the module is disabled
}