Activation
Last updated
Last updated
The activate logic is some logic that execute when the plugin is activated.
This happens in two cases:
when the plugin installs.
when the plugin got disabled and is re-enabled.
It is possible to use that state to initialize the plugin:
By creating tables.
By creating initial configurations.
In Launchpad, to create a logic which will be executed when the plugin is activated, we need to use an Activator.
To create an activator, any class can be used as the only requirement is to inside the docblock of at least one of the methods:
Once the activator class is created, it needs to be registered on a service provider to be loaded.
For that it is important to first using interface and trait:
It is then possible to have access to the inside :