Skip to content

Instantly share code, notes, and snippets.

@emjayess
Created September 18, 2012 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emjayess/3743754 to your computer and use it in GitHub Desktop.
Save emjayess/3743754 to your computer and use it in GitHub Desktop.
[re]define preprocess hooks for theming individual views, displays, fields, rows, etc...
// somewhere in themes/best_theme_ever/template.php
/**
* Implements hook_preprocess_views_view
*/
function bte_preprocess_views_view(&$vars) {
if (isset($vars['view']->name)) {
$view_preproc_by_name = 'bte_preprocess_views_view__'.$vars['view']->name;
//
if (function_exists($view_preproc_by_name)) {
$view_preproc_by_name($vars);
}
}
}
// somewhere else in themes/best_theme_ever/template.php
/**
* Implements preprocess for 'news' view
*/
function bte_preprocess_view_views__news(&$vars) {
// preprocess operations...
}
@emjayess
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment