Module Development

Plugin Derivatives for Drupal 8, 9, and 10

Plugin derivatives allow a single plugin to dynamically generate multiple plugin instances based on configuration or other data. This is useful for situations where user-entered data, or other dynamic configuration, might have an impact on available plugins. Or, put another way, any time you need to be able to dynamically generate plugin definitions.

In this tutorial we'll:

  • Define what plugin derivatives are
  • Understand the use case for derivatives
  • Examine how core uses derivatives in order to demonstrate how you could write your own plugin deriver class

Drupal Module Development