Introduction
In a bid to separate logic from presentation, Drupal's theming system tries to minimize the amount of PHP that is necessary in a template file. This ensures that themers who are not as comfortable in a PHP environment, are not exposed to the nitty-gritty of complicated code manipulations. Instead, they are provided with a host of pre-prepared variables which contain the content of the body of the page, the blocks, the sidebars, and so on—depending on the nature of the template—or those that describe other elements of the page such as user details or submission information which can be utilized in the template file.
But the question arises: Where do these variables come from? And how can they be modified? This is where preprocess functions come in. Prior to the execution of every template file, Drupal calls a set of functions known as preprocess functions which insert, modify, and in general, organize the variables which are available for use in the file. Furthermore, as we saw...