I'm still working to get comfortable with Drupal theming.

I moved a working preprocess function from template.php into my module (then removed the old one to avoid it overriding the new one), since I want to set variables in my module.

I renamed the function by removing the theme name and replacing it with my module name.

After emptying the cache, I conducted a page request, and the new function is not acknowledged (I tried doing a var_dump() on a variable within, but the dump was never called).

The hook part of the preprocess goes to a template file associated with a view, fwiw.

Do I need to do something else to register a mymodule_preprocess_hook?

Comments

Scott McCabe’s picture

To troubleshoot, I renamed the function to mymodule_preprocess_node and the function was properly called.

Then I renamed it to a more generic mymodule_preprocess_views_view, and the function was properly called.

Corresponding with the template file name of views-view--xxx-xxxxxxx-xxxx.tpl.php, when I renamed it to the desired mymodule_preprocess_views_view__xxx_xxxxxxx_xxxx, it stopped working again.

While I could just add a unique variable to the views_view preprocessor (only using it in the one template file), which will be my temporary fix, I prefer a solution that does not add that variable to every view's variables array, if such a solution exists.

Scott McCabe’s picture