Taste the Power of Drupal Plugins!
summary
Explains how Drupal maps plugin ID to a PHP class and instantiates instances via createInstance with ID+config, shows discovery via PHP attributes over annotations and YAML, and demonstrates derivatives (views block per display) and config entities storing plugin ID plus settings. Gives concrete examples: a queue worker using queue worker processItem run on cron (example limit: 60s), a REST resource that should use container-factory injection instead of static DB calls, and a recipe to load the config entity and call getPlugin.
AI-written summary · about
chapters (15)
- 0:00Introduction to Drupal plugins
- 1:24What are plugins in Drupal
- 3:54Plugin IDs and instances
- 7:29Plugin managers and discovery
- 11:19Defining plugin classes
- 14:27Plugin attributes and definitions
- 16:33YAML and annotation discovery
- 21:05Plugin derivatives explained
- 23:56Config entities and plugins
- 28:08Creating a custom block plugin
- 30:15REST endpoints and plugins
- 34:53Dependency injection in plugins
- 37:44Queue workers and background tasks
- 38:46Defining custom plugin types
- 43:01Key takeaways and summary
