Coding standards

When developing for Drupal, it is not only a best practice to follow the Coding Standards for configuration (https://www.drupal.org/coding-standards/config), but it is also one of the things you need to internalize in your daily work. Of course, the Coding Standards do not apply to PHP only; there are even some guidelines for writing schema files.

The first rule of thumb is to simply follow the code style of the .yml files, as seen everywhere else in Drupal code. The key points are as follows:

  • Add a comment to the file, explaining the purpose and the content of this file. If there is only one schema file in your module, you may use a comment such as # Schema for the configuration files of the {YOURMODULENAME} module.
  • Do not use double ...

Get Drupal 8 Configuration Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.