diff --git a/views.module b/views.module index 20258df..77baa22 100644 --- a/views.module +++ b/views.module @@ -467,14 +467,33 @@ function views_menu_alter(&$callbacks) { function views_arg_load($value, $name, $display_id, $index) { static $views = array(); + $view = views_get_view($name); + if (!$view) { + return; + } + + if (is_array($display_id)) { + $ids = $display_id; + $display_id = FALSE; + foreach ($ids as $id) { + if ($view->access($id)) { + $display_id = $id; + break; + } + } + } + + if (!$display_id) { + return; + } + // Make sure we haven't already loaded this views argument for a similar menu // item elsewhere. $key = $name . ':' . $display_id . ':' . $value . ':' . $index; if (isset($views[$key])) { return $views[$key]; } - - if ($view = views_get_view($name)) { + else { $view->set_display($display_id); $view->init_handlers();