A Practical Introduction to OOPing in Drupal

gapple

While some Object Oriented components were already introduced in Drupal 7 through improvements such as the updated database layer and in contributed modules such as Entity API, Drupal 8 extended this substantially to almost all core components.  For the new developer, and even the experienced Drupalist, this introduces new concepts required to perform common development tasks in Drupal 8, but opens up the possibility to interact with the much wider PHP ecosystem.

This session will provide a practical reference for those new to object oriented development by explaining concepts as they are introduced via a walk through of the process of rebuilding a top-25 Drupal 7 module from scratch for Drupal 8.  Get started with basic objects, inheritance, and interfaces; keep things organized with namespaces and autoloading; use traits to reuse code more effectively; implement a custom event (and event listener); and get familiar with Drupal’s base classes to connect it all together.  The end result is a flexible object-oriented structure and a *.module file of only five lines.

Attendees should already have an understanding of writing php for Drupal 7, and should walk out with an understanding of the concepts necessary to create and extend object-oriented PHP.

Session Track

PHP

Experience Level

Beginner

Drupal Version