Answers for "hook_views_pre_view drupal 7"

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);
}
Posted by: Guest on March-17-2021
1

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');
  }
}
Posted by: Guest on March-25-2021

Code answers related to "hook_views_pre_view drupal 7"

Browse Popular Code Answers by Language