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
有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
scroll top