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:
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.
So re-using theme hooks in various places in our code is a good thing, of course. However, one problem you'll encounter ...