📜  drupal 7 hook_views_pre_view - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:56.294000             🧑  作者: Mango

代码示例1
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');
  }
}