How Drupal modules work - Conclusion

Last revision:

You don't need to write lots of complex code to create your own Drupal modules: a single folder with two small code files can already make Drupal do what you want.

As of Drupal 8, Drupal uses mostly Object Oriented PHP code, so it's important to refresh your OOP skills and learn about concepts such as namespaces, classes, interfaces, inheritance, annotations, and dependency injection.

Info files as well as some other module-level files use the YAML syntax.

Drupal "discovers" many contributed things (Events, hook implementations, new permissions, new routes, news menu items, and much more) through a combination of functions, classes, and configuration files that follow strict conventions for their name and location.

This principle is called "convention over configuration", and reduces the amount of code necessary to make Drupal aware of new things. However, conventions are "invisible" and not always very well-documented, so it's important to read the Core API documentation carefully and look at examples online and in Drupal's source code to better understand how they work.

This mini-course represents only a very small part of Drupal module development, and is only intended to give you a general idea about how Drupal modules work. If you want to learn more, check out our in-depth courses on module development.