1

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:

  1. entup doesn't WSOD because my new field depends on a non-existent module.
  2. 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?

  • 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). – user21641 Aug 14 '17 at 15:17
  • I think the question is asking what can you do after you've enabled the module and now need a dependency. – Kevin Aug 14 '17 at 15:29
2

@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.

  1. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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