public function view::choose_display in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 includes/view.inc \view::choose_display()
- 6.2 includes/view.inc \view::choose_display()
Get the first display that is accessible to the user.
Parameters
string|array $displays: Either a single display id or an array of display ids.
2 calls to view::choose_display()
- view::execute_display in includes/
view.inc - Execute the given display, with the given arguments. To be called externally by whatever mechanism invokes the view, such as a page callback, hook_block, etc.
- view::set_display in includes/
view.inc - Set the display as current.
File
- includes/
view.inc, line 526 - views_objects Objects that represent a View or part of a view
Class
- view
- An object to contain all of the data to generate a view.
Code
public function choose_display($displays) {
if (!is_array($displays)) {
return $displays;
}
$this
->init_display();
foreach ($displays as $display_id) {
if ($this->display[$display_id]->handler
->access()) {
return $display_id;
}
}
return 'default';
}