I’m coding a very complex plugin which is organized as a parent “container” class and several subclasses. Each subclass is an optional/mandatory element which usually (but not always) maps to his own add_submenu_page.
Basically, it’s a plugin with his private set of let’s call them “subplugins”.
Every subclass/subplugin has its own (big) set of add_action and add_filter. So, technically speaking, my plugin’s subplugin is a valid WP plugin, simply it’s not called directly by WP itself.
Since i planned…actually tons of add_action…I’m wondering if i should refactor my plugin using a ‘private’ Observer/Mediator pattern ie. collect all relevant add_actions to my parent class only and baking up a pattern to notify/forward subclasses of events, reducing the impact of my plugin to WP event ques.
Is it a good idea or it’s absolutely not necesssary? Can u help me with some code for the class refactoring?
tnx in advance for help,
- The topic ‘Plugin with many subclasses/Is better to use add_action or a private Observer?’ is closed to new replies.