0

How do I pass a variable from a preprocess hook to a template file for a single field, that is view files starting with

views-view-field--

I want to know what are the preprocess functions that can be used for this purpose. Because, whenever I try to set a variable using hook_preprocess_views_view_fields it is only renderable at sytle/row level, but never at single field level.

Hope Im clear with my query. Any help appreciated.

1

I think it's just that there are two similarly-named theme implementations: views_view_field and views_view_fields (trailing s). Generally you can take the name of the template file before the first double-dash to find the theme implementation name, so if the template starts with views-view-field-- you'd expect the preprocess to be hook_preprocess_views_view_field(). (That naming pattern's not guaranteed though.)

  • What was I thinking? duh Thanks a lot man, works like a charm. – Pratip Ghosh Jan 7 '16 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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