Finding the Contents of $variables
The contents of the
$variables array are different for each theme hook; even the contents of the same theme hook vary based on other factors, such as the view mode or user role.
The first thing to do after creating the function is to print the array and find out what’s inside for you to work with. As explained in the “Finding Available Variables in the Theme Layer” section, using the
dpm() function is a great way to do this, as shown in Listing 16–7.