O'Reilly logo

Drupal 7 Module Development by Ken Rickard, John Wilkins, Larry Garfield, Matt Butcher, Greg Dunlap, Matt Farina

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The power of theme()

It turns out that the theme() function has to do quite a bit of work once it's called. The following diagram should make its responsibilities and its order of operations clearer:

The power of theme()

We've actually already discussed most of the work flow of theme(). There's only one aspect we haven't yet seen. So far, we've only called theme() with a simple string passed to its $hook parameter. However, we can actually pass more complex data to it and make use of the theme system's theme hook suggestions.

Theme hook suggestions

So re-using theme hooks in various places in our code is a good thing, of course. However, one problem you'll encounter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required