2

Omega theme has a singular way to add preprocess functions.

I need to add this preprocess function to be executed when a view is rendered:

function MyTheme_alpha_preprocess_views_view_fields(&$vars) {
...
}

This is what I've done (is not working, the dpm function doesn't print the message, no error is shown)

1) In sites/all/themes/MyTheme/preprocess/created the file preprocess-views-view-fields.inc

2) In preprocess-views-view-fields.inc I added the function:

   function MyTheme_alpha_preprocess_views_view_fields(&$vars) {
     dpm('hello');
    }

What am I missing?

  • 1
    Standard question: Have you cleared the cache since adding the file and adding the new preprocess hook? – Clive Dec 17 '12 at 14:11
  • @Jimajamma Omega lets you split out preprocess and process functions into separate include files. The base theme itself scans/includes/invokes them, and part of this is a slightly different naming convention to avoid clashes with putting the functions directly in template.php. – mpdonadio Dec 17 '12 at 14:35
  • @clive: I cleared cache several times. – chefnelone Dec 17 '12 at 20:25
  • you put this function like this template_preprocess_views_view_fields(&$vars) in your template.php – Sathiya Dec 18 '12 at 6:27
  • I think that the problem is that I have Aggregation enabled in the view... – chefnelone Dec 19 '12 at 16:45

Your Answer

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

Browse other questions tagged or ask your own question.