You are here

function view::choose_display in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 includes/view.inc \view::choose_display()
  2. 7.3 includes/view.inc \view::choose_display()

Get the first display that is accessible to the user.

Parameters

$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 420
view.inc Provides the view object type and associated methods.

Class

view
An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.

Code

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';
}