Hi there,

What is the preprocess function to use for a 'mycustomtemplate' custom template? (using 7.x-2.0)

I have tried the following without success:

  • mytheme_preprocess_views_custom_template (per theme developer list)
  • mytheme_preprocess_views_view_unformatted__mycustomtemplate
  • ... and other combinations

Thanks!

Comments

rudiedirkx’s picture

Assigned: Unassigned » ericclaeren

Eric should probably answer this, since he made 2.0. My answer:

Since views_custom_template doesn't register a theme function, it doesn't expose a preprocessor hook. The preprocess function it uses (template_preprocess_views_custom_template) works because of a theme registry alter, which checks for all views_view* theme functions. So maybe you should use the normal views preprocessor hooks... What are you trying to achieve? Alter the $vars? Then, yes, use the normal Views preprocessor.

Eric?

rgx’s picture

Thanks!

Yes, alter the $vars.

mytheme_preprocess_views_view_unformatted works,

but I'm looking for something especific to the 'mycustomtemplate'.

rudiedirkx’s picture

There's no specific hook, but you should have all the info in $vars, so you can check there.

If that's not good enough, I could make a fake preprocessor in my custom preprocessor... Same exact result though.