function view::choose_display

3.x view.inc view::choose_display($displays)
2.x view.inc view::choose_display($displays)

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