-2

In Drupal9 , if a module has dependencies, as in

my_master_module.info.yml

dependencies:
  - dependency1:dependency1
  - dependency2:dependency2

you cant disable/uninstall any of these dependencies using the UI - the checkbox to do that is disabled.

However, if a (custom) modules dependencies have updated, the dependant module does not automatically get enabled. You can also not enable it using the UI, because the checkbox is disabled.

In fact, if you use drush to enable the already enabled module, it seemingly tries to enable its dependencies, but it doesn't:

./drush pm:enable my_master_module
The following module(s) will be enabled: dependency1, dependency2

 Do you want to continue? (yes/no) [yes]:
 > yes

 [success] Successfully enabled: dependency1, dependency2

But then .. it did not.

Is there a way to update/reload a custom modules dependencies, so, that Drupal enables all the dependant modules ?

1 Answer 1

1

Use hook_update_N. Here is an example implementation from Metatag (file metatag.install):

/**
 * Enable the new metatag_open_graph module.
 */
function metatag_update_8107() {
  \Drupal::service('module_installer')->install(['metatag_open_graph']);
  return (string) new TranslatableMarkup("The new Metatag: Open Graph module has been enabled.");
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.