7 to 8: Transitioning From theme() and Theme Functions to Render Arrays and Templates

Render arrays aren't new in Drupal 8. For years they have shared responsibility with theme() when rendering a page and everything in it. Don't call theme() in Drupal 8, though. It's gone. Render arrays are taking over and you should already be using them in Drupal 7.

Theme functions, such as theme_image() and theme_item_list(), are also losing the battle. They can still exist in Drupal 8, but templates and preprocess/process functions are far more common. Templates aren't new either, but like render arrays, they are far superior.

Start using both today. This session has your back. It will cover:

  • using render arrays instead of the theme() function
  • converting a theme function to a proper template and preprocess/process functions
  • the advantages of using each over their dying counterparts