Module Development

Implement a YAML Plugin for Drupal 8, 9, 10, and 11

Many of Drupal's APIs that look like a bunch of configuration in a YAML file (migrations, menu links, etc.) are actually plugins in disguise. The YAML from these files is used as arguments to a generic PHP plugin class which then behaves differently depending on the provided values. As a developer, you probably don't need to know that menu links are plugins, but it can be helpful when debugging or just trying to get a better understanding of the big picture.

In this tutorial, we'll:

  • Learn about how YAML-based plugins work
  • Discuss how to find the implementation details for YAML-based plugins
  • Walk through an example of implementing a YAML-based plugin

By the end of this tutorial, you should be able to recognize a YAML-based plugin definition, and author your own.