drupal hook views_pre_render methods code example
Example 1: drupal 7 hook_views_pre_render
function hook_views_pre_render(&$view) {
// Scramble the order of the rows shown on this result page.
// Note that this could be done earlier, but not later in the view execution
// process.
shuffle($view->result);
}
Example 2: drupal 7 hook_views_pre_view
function hook_views_pre_view(&$view, &$display_id, &$args) {
// Change the display if the acting user has 'administer site configuration'
// permission, to display something radically different.
// (Note that this is not necessarily the best way to solve that task. Feel
// free to contribute another example!)
if ($view->name == 'my_special_view' && user_access('administer site configuration') && $display_id == 'public_display') {
$view
->set_display('private_display');
}
}