function view::choose_display

Same name in other branches
  1. 7.x-3.x 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

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