Plugin Components

While the main plugin instance class of your project should implement the PluginInterface interface, the other classes should implement the PluginComponentInterfacearrow-up-right interface. Obvious exceptions are classes designed to be utilities -- and anything else that you think shouldn't (we don't know your project!).

Plugin components are simple though. They simple posses an ID, a name, and a means to get the main plugin instance. For example, our Locked Payment Methods pluginarrow-up-right has a class for each unlock strategy and each of those classes is a plugin component. The name of the user profile unlock strategy is simply User Meta Unlock Strategy and its ID is an autogenerated hash.

circle-info

The ID of a plugin component can be anything that identifies it uniquely, whereas the name is designed to be spelled out in plain English for human understanding.

circle-exclamation

As you probably expected by now, there is a PluginComponentTraitarrow-up-right trait offered that provides a basic implementation of the interface methods. Moreover, the AbstractPluginComponentarrow-up-right class also provides sensible defaults and magic use of your getters and setters.

Last updated