4

Note: this is not the book module from core.

I inherited a custom module that was not written by me. Its .info.yml contains a project: key which I have never seen ever before.

ps_book.info.yml

name: Book
type: module
description: Provides lesson page structure
package: Pivotal Science
dependencies:

version: '8.x-1.0'
core: '8.x'
project: 'ps_book'

I noticed that when I install the module I get 3 errors in the log.

I did a mouseover, so you can read the full error. The other two are the same except they end in es.po. and fr.po.

enter image description here

In Let Drupal 8 know about your module with an .info.yml file I couldn't find any mention of the project: key.

If I remove the project: 'ps_book' line, I no longer get those 3 errors when I install the module.

Is there any official doc for this key? If not, should someone add it the docs?

3

The Drupal 8 documentation for the keys to use in a .info.yml file doesn't mention it, but that is the same key documented in Writing module .info files (Drupal 7.x).

project (Discouraged, packaging use only)

Module maintainers should not use this at all. The packaging script on drupal.org will automatically place a string here to identify what project the module came from. This is primarily for the Update status module, so that Drupal installations can monitor versions of installed packages and notify administrators when new versions are available.

Drupal uses its value for building URLs when finding information about the module, or any file related to it. Technically, every Drupal core module could use the value of the project key to build a URL for something related to a module. I take the documentation gives the primary use of that key, since the Update module is present in all the last versions of Drupal.

I guess that, since its usage is discouraged, they don't document it for Drupal 8 to avoid users add it in their .info.yml files. It could help users creating a module that handles new keys in .info.yml files, though.
As for documenting it, I would document it just to avoid a developer creates a module that handles custom keys that conflict with the ones already used from Drupal core. I can understand this is seen as a use case that remotely interest developers, though.

  • Interesting, perhaps they added to or changed the functionality of this key for D8? As you can see from my screenshot, it tries to download some translation files from drupal.org which is not mentioned in your D7 quote. – No Sssweat Apr 13 '17 at 5:41
  • 1
    The project name is used from drupal.org for many URLs related to a project hosted there. Technically, every Drupal core module could use the value of that key to build a URL for something related to a module. I take the documentation gives the primary use of that key, since the Update module is present in all the last versions of Drupal. – kiamlaluno Apr 13 '17 at 6:44
  • Your last comment is good enough for me. Interesting enough, when I install this module on a fresh Drupal install, I do not get those error messages; even though, the module has the project: line. There is probably some setting or other module that needs to be enabled in order for the errors to occur. – No Sssweat Apr 13 '17 at 7:15
  • You would probably have the same issue from the moment that Drupal core module logging the error you shown tries to download the translation for the module. Until then, you should probably not notice anything. – kiamlaluno Apr 13 '17 at 7:38

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.