Adding a new dependency to a module As a module maintainer, I want to add a dependency to one of my existing modules, so that my entity can use a field type plugin declared by the dependency.

What steps do I need to take to make sure that:


entup doesn't WSOD because my new field depends on a non-existent module.
Drupal end-users get prompted to download and install the new dependency.


I did find another similar issue -- What is the protocol for adding a new module dependency to a module that has only had a dev release? -- which deals with Drupal 7. This will help address question #2, but doesn't speak to the added complexity of entup.

I also found an issue dealing with deployments via drush -- Enable new modules dependencies on deploy -- but this doesn't address my questions either.

Any other tips or advice?
@Ivan Jaros is correct.


a) use dependency in your module info file, b) implement hook_requirements, c) activate the field only if the other module exists(ie. soft dependency).


  @Kevin, after you've enabled the module


Use a) and c) above.


  
  Drupal end-users get prompted to download and install the new dependency.
  


In c) you need to set a message to the user explaining why the field is unavailable and where to get the dependency.  Use function drupal_set_message.

Links:

D8: module exits, https://www.drupal.org/node/1894902 , see \Drupal::moduleHandler()->moduleExists($module)

D8: set message,  https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.4.x