Vancouver, October 5-6, 2012

Paradigm Shift: Drupal 7 Hooks to Drupal 8 Plugins

Development and Code
Experience Level: 

Modules in Drupal are meant to interact with, extend, or alter the behavior of Drupal Core or other modules. In Drupal 7 and previous versions of Drupal, the basic mechanism for doing this was implementing a hook: writing a function that provides information or alters behavior in a controlled way. Drupal 8 still has some hooks, but many interactions and alterations that in previous versions of Drupal would be accomplished by implementing hooks have been replaced by a plugin mechanism, which involves making a PHP class to define the desired behavior.

This talk will lead you through the paradigm shift from hooks to plugins. Using one or more examples, we'll see how to implement the same behavioral change using Drupal 7 hooks and Drupal 8 plugins, and learn about PSR-0, namespaces, and plugin annotation along the way.