Problem / Motivation
Current in order for someone to enable a module programmatically in Drupal 8. They either need to write a hook_update to programmatically enable the module like this...
/**
* Implements hook_update.
*/
function BestUpdateever_update_7000() {
module_enable(array('mymodule'));
}
Or write a chain command that will enable the module similar to this ...
- command: module:install
options:
learning: true
arguments:
module:
- ld
Any of these methods generates a lot of unnecessary code. Instead, what we should be doing is having a module that is already installed added as a dependency in their .info file.The user is going to use module:dependency:install command to find if there are any dependency for that module on their deployment script.. If there is going to install all modules that are not enabled.
This will decrease the amount code because the end results should be scripts that always check if there are any dependency available and adding that dependency to your installed module.
Solution
- Create a module that allows you to look for any uninstall dependency in your installed module and install them.
Problem / Motivation
Current in order for someone to enable a module programmatically in Drupal 8. They either need to write a
hook_updateto programmatically enable the module like this...Or write a chain command that will enable the module similar to this ...
Any of these methods generates a lot of unnecessary code. Instead, what we should be doing is having a module that is already installed added as a dependency in their .info file.The user is going to use
module:dependency:installcommand to find if there are any dependency for that module on their deployment script.. If there is going to install all modules that are not enabled.This will decrease the amount code because the end results should be scripts that always check if there are any dependency available and adding that dependency to your installed module.
Solution