views:

713

answers:

2

(Note: I originally posted this on drupal.org before remembering that I never get a response over there. So, sorry for the cross-posting)

Hello, is there a way (built-in or otherwise) to add preprocessing functions for particular cck node types? I am looking to do some preprocessing of a field within my cck node type. Currently I can either use theme_preprocess_node and then do a switch on the $node->type or use a theming function for a particular field name (and still do a switch to make sure the current field usage is within the node type i'm looking for). What I am suggesting is to have a function like this...

theme_preprocess_mynodetype(&$vars) {
    // Now I can preprocess a field without testing whether the field is within the target content type
}

...but I can't figure out if I can suggest preprocess functions the same way I can suggest template files

Thanks! Rob

A: 

I think that you're looking for this post. There's no magic per-node preprocess, only per theme/template engine, but you do have access to the node type in the $vars parameter so you can switch on it there.

Hope that helps!

Chuck Vose
Hey thanks, I saw that one but that function uses the node preprocessor with a switch, which i was trying to avoid (kinda) to stop that preprocessor from growing to large.I guess I could use theme_preprocessor_node with a switch that actually calls theme_preprocessor_cat(), theme_preprocessor_dog(), etc. But maybe there is no automatic way or no way to suggest preprocess functions (the way tpl files are suggested)?
rob5408
A: 
Nikit
Thanks for looking that up. In this function, CCK actually sets up the suggestions for tpl files but not the preprocess functions (from what I can tell), but it has lead me to dig more through the content.module. Will post what I find.
rob5408

related questions