1

I'm using drupal 7.29 . I'm trying to write the preprocess function for a specific view named front-page. I have written the following functions in my template.php file:

function bartik_sub_preprocess_views_view__front_page(&$variables) {

  kpr($variables);
}

The function for preprocessing view works normally (without the __front_page at the end), but the above function isn't being called. I did create the corresponding .tpl.php (views-view--front-page.tpl.php) file which is used but the function still isn't being called. I watched a couple of tutorials where the preprocessing function for a specific view was written like this and it worked, any ideas why this isn't working?

2 Answers 2

0

you have to implement hook_theme function to make views aware of your custom preprocess theme function. You can find a tutorial on this here: http://www.appnovation.com/blog/theming-view-within-your-module

0

I have been trying for a couple of days and this solution is not working. The function

function bartik_sub_theme($existing, $type, $theme, $path) {
  kpr($theme);
}

isn't being called. In a tutorial I watched (https://www.youtube.com/watch?v=1Cfc11_sb5M) the guy just defines the preprocessing function and that is it. Even the Devel modul is suggesting

theme_hook_suggestion (String, 22 characters ) views_view__front_page

I really don't know what I am doing wrong. Any idea?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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