Render API - The ins and outs of renderable arrays in Drupal 7

Presented by

Track: 
Coding and Development
Experience level: 
Intermediate

Watch the Screen Capture

One of the most interesting and potentially confusing features of Drupal 7 is the extended and improved Render API. Although the concept of renderable arrays existed in Drupal 6 they are now more important and pervasive and have become an essential tool for module developers and themers alike.

In this session you will learn what a "renderable array" or "renderable structure" is, how they are used in Drupal 7 and how they differ from Form API arrays in Drupal 6.

We'll disect a handful of renderable arrays from Drupal core and talk about the process that Drupal goes through in order to turn a structured array into an HTML string. Along the way we'll learn about some of the tips and tricks that you can use when creating your own render arrays to ensure that they are sane and that the content output by your module is alterable.

Then we'll take a look at some of the advantages this new Render API gives us including the ability for modules to alter the content provided by another module and for themes to modify and move elements the page quicker and and easier then ever before.

The session will conclude with a short discussion of how you can create your own renderable element types and encasulate complicated theme or module logic into a simple element #type.

Intended audience:

Theme and Module developers looking to take advantage of the new Render API and leverage the full power of Drupal 7. Anyone who is either not familiar with renderable arrays at all or that has a basic understanding of Drupal 6 Form API will benefit from this session. Attendees should have at least a basic background in either Drupal module or theme development and an understanding of basic arrays in PHP.

Time slot: 
21 May 14:30 - 15:30