Score:-2

How to reload a (custom) modules dependencies

in flag

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 ?

Score:1
id flag

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.");
}
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.