The MYTHEME_preprocess_views_view($vars)
hook is executed at the end of the process to build a view. The purpose of the *views_view.tpl.php* is a general wrapper for all elements of the view. The result of fields have been builded and rendered and they have been stored in the variable $vars['raws']
.
If you want to change, alter, unset a view, we can do in different phases. Between them, i've chosen the pre-render phase:
function HOOK_views_pre_render(&$view){
if(isset($view->name) && $view->name == 'YOUR_VIEW'){
// kpr($view);
foreach($view->result as $r){
$r->field_field_NAME[0]['rendered']['#markup'] .= '. ADDING TEXT TO CHANGE THE RESULT';
}
}
}
These are the stages that are given by Views API (you will find it in the views folder). Maybe one of them is more useful:
hook_views_pre_view(&$view, &$display_id, &$args){}
Allows altering a view at the very beginning of views processing, before
anything is done.
hook_views_pre_build(&$view)
This hook is called right before the build process, but after displays
are attached and the display performs its pre_execute phase.
hook_views_post_build(&$view) {}
This hook is called right after the build process. The query is now fully
built, but it has not yet been run through db_rewrite_sql.
hook_views_pre_execute(&$view){}
This hook is called right before the execute process. The query is now fully
built, but it has not yet been run through db_rewrite_sql.
hook_views_post_execute(&$view) {}
This hook is called right after the execute process. The query has
been executed, but the pre_render() phase has not yet happened for
handlers.
hook_views_pre_render(&$view) {}
This hook is called right before the render process. The query has been
executed, and the pre_render() phase has already happened for handlers, so
all data should be available.
hook_views_post_render(&$view, &$output, &$cache){}
Post process any rendered data.