I would like to define 'theme_hook_suggestions' for a custom views-view.tpl.php file.
To achieve this, I wrote the following code into my template.php file:
/**
* Implements hook_preprocess_views_view().
*/
function MYTHEME_preprocess_views_view(&$variables) {
// Some logic to decide if the hook_suggestions should set or not
// ...
$variables['theme_hook_suggestions'][] = 'foo';
}
After that, I created a copy of views-view.tpl.php in the templates folder named foo.tpl.php.
Sadly, my template file is ignored by Drupal and the default views-view.tpl.php file is rendered on the page.
What's the matter? I debugged the theme_registry and the template path should be correct (points to my theme).
Update The target is that I can switch between two template files which are defined in my preprocess function (see above). Because in some cases, my layout markup is significant different as in other cases.
I don't want to use the same template file for both cases; when I do this, the file is full of tousands of if()
just for adjusting the markup for some cases.
if
s in it, IMO.