2

We recently updated to Drupal Core 8.6.2 and noticed there are changes to module dependencies. We are noticing that drupal: is added before the module names. We were unable to find any documentation that further explains it.

How would we add Drupal Core modules as dependencies on custom modules post 8.6.2?

mymodule.info.yml example before 8.6.2

type: module
name: my module
description: my custom module
package: 8.x
core: 8.x
dependencies:
  - field
  - image

mymodule.info.yml example after 8.6.2

type: module
name: my module
description: my custom module
package: 8.x
core: 8.x
dependencies:
  - drupal:field
  - drupal:image
2

If you're referencing a recent change in a core module, it was a style/formatting change.

Adding namespaces for dependencies has been in core for a while. The {project}:{module} format is a better practice for removing ambiguity in the event of module/project machine name overlap, but both will work.

For documentation reference, see Let Drupal 8 know about your module with an .info.yml file under the example section for dependencies:

dependencies - A list of other modules your module depends on. Dependencies should be namespaced in the format {project}:{module}, where {project} is the project name as it appears in the Drupal.org URL (e.g. drupal.org/project/views) and {module} is the module's machine name. Dependencies can also include version restrictions, for example webform:webform (>=8.x-5.x). Note that if your module has dependencies on other contributed modules or libraries, these should be declared in the module's composer.json file.

  • your assumption is correct about recent change in core module. I had not checked the Let Drupal 8 know about your module with an .info.yml file in over a month and looks to be recently updated. That resolved the issue and cleared up the question. – usernameabc Nov 6 '18 at 19:24

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.