Is your feature request related to a problem?
Currently, the only way to add modules from other places is via adding an action to this hook
The hook name is created dynamically based on the package name.
Since #44 was merged it would be very nice to have a way to add a module with an extension to all packages automatically.
So, in a project with many packages we could do:
add_action('inpsyde.modularity.package.init', fn($package) => $package->addModule($moduleWithExtensionByType));
Describe the desired solution
Maybe the solution is to add a hook.
Describe the alternatives that you have considered
Option 1:
Adding a generic hook
Option 2:
Using current hookName is also an option but you should hook in another hook like
function addExtensionCb (){
/* some logic parsing current_action() name with startsWith inpsyde.modularity and endWith init */
}
add_action('muplugins_loaded', function(){
add_action('all', 'addExtensionCb');
}, PHP_INT_MIN);
add_action('plugins_loaded', function(){
remove_action('all', 'addExtensionCb');
}, PHP_INT_MAX)
Additional context
No response
Code of Conduct
Is your feature request related to a problem?
Currently, the only way to add modules from other places is via adding an action to this hook
The hook name is created dynamically based on the package name.
Since #44 was merged it would be very nice to have a way to add a module with an extension to all packages automatically.
So, in a project with many packages we could do:
Describe the desired solution
Maybe the solution is to add a hook.
Describe the alternatives that you have considered
Option 1:
Adding a generic hook
Option 2:
Using current hookName is also an option but you should hook in another hook like
Additional context
No response
Code of Conduct