Creating and Using Plugins as a Module Developer
Ever wanted to learn about Drupal plugins as a module developer? Ever wondered what makes Drupal plugins work or why they’re useful? Well, literally every Drupal 8 module uses the Drupal plugin system! At their core, plugins are extensible bits of functionality. They are in YAML files, in Annotation classes, in hooks, and/or can be defined statically. Plugins can also have a custom discovery mechanism. Just create a custom plugin discovery class and use a plugin manager service.In this tutorial, you will learn:
- How to use Drupal plugins
- How to create new plugins
- Why choose to use plugins
We will also explore plugin discovery, plugin decorators, plugin management, plugin derivatives, and plugin definitions. You'll learn how to wrap functionality around the main Plugin discovery class with a Plugin discovery decorator. Using a Plugin decorator, you can provide or alter existing configurations, and/or provide multiple discovery methods. Plugins are in many places and are crucial to every module in Drupal. Having a hard time thinking about what plugins already exist in Drupal? There are quite a few!
- Some YAML plugins include routing, menu links, libraries and permissions
- Some Annotation plugins include blocks, field types, actions, entity reference selections, content and configuration entity types
As you can see, Drupal Plugins are almost everywhere you look! I want to take you on a cosmic adventure into the Drupal Plugin universe. Please come with me.