This site is archived.
Skip to Content

Plugins: Making code swappable

Your session in a few words: 
Do as Views does and let users rewrite your code
Track: 
Extra credit
Session Type: 
Lecture
Level of expertise: 
Intermediate
Language: 
English

Plugins are a key part of the Views API. They allow a developer to write their own implementation of part of a View and swap it in at will, changing the behavior of a query.

Formerly called "Handlers", Plugins for Drupal 7 are a more generalized tool to allow developers to easily swap out parts of their code using simple object-oriented principles. Controlled at runtime, meaning site admins can easily swap out one caching engine for another, one path alias system for another, or even one theme system for another, plugins give site maintainers flexibility to "hack core without hacking core". They're the perfect complement to hooks, handling many-to-one extensibility rather than the one-to-many extensibility of hooks.

As of this writing Plugins are still in active development. If they do not end up in Drupal 7 core, they will be available as a contrib module the day Drupal 7 is released.