Deactivation
The deactivate logic is some logic executed each time the plugin got disabled.
It is possible to use that state to interrupt the plugin:
By cancelling crons.
By updating the settings.
Create a deactivate logic
In Launchpad, to create a logic to be executed when the plugin disabling, we need to create a deactivator.
To create a deactivator, any class can be used as the only requirement is to use @deactivate
annotation inside the docblock of at least one of the methods:
Once the deactivator class is created, it needs to be registered on a service provider to be loaded.
For that it is important to first add the necessary logic into the provider using HasDeactivatorServiceProviderInterface
interface and HasDesactivatorServiceProviderTrait
trait:
It is then possible to have access to the register_deactivator
method to register our deactivator inside the define
method:
Last updated