I have a file called template.php and inside the template file I have a preprocessor but I have two problems I don't know if the preprocessor is loading and if the code in the file is right.

The code inside the file is

function template_preprocess_field(&$vars) { kpr($vars); //Uncomment to output the $vars array. }

At this stage all I am trying to do is see if I can get the node to give me some feedback but I get nothing. The nodes I am testing this on does have three fields

closed as unclear what you're asking by kiamlaluno Aug 9 at 8:08

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Version numbers and location of template.php is required to answer your question. – user7667 Jul 20 '12 at 7:04
  • drupal7 and themename->templates->template.php – gistworld Jul 20 '12 at 7:13

Your template file should reside in the sites/all/themes/mytheme/ directory. Not in the templates subdirectory. Furthermore, your preprocess function should be named mytheme_preprocess_field(). Be sure to clear your cache.

You might want to perhaps also look at the Devel Themer module. It should provide information on the preprocess function being used and so on. I'm unsure how well it works with Drupal 7. But it's worth your time if it does.


Definitely, definitely get the Devel Theme module. It can be a great help in Drupal 7 when digging through the arrays on that page so you won't make any mistakes. It will give a simple list of the field names you can then call.

Not the answer you're looking for? Browse other questions tagged or ask your own question.