public function ViewExecutable::chooseDisplay

Get the first display that is accessible to the user.

Parameters

array|string $displays: Either a single display id or an array of display ids.

Return value

string The first accessible display id, at least default.

2 calls to ViewExecutable::chooseDisplay()
ViewExecutable::executeDisplay in drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php
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.
ViewExecutable::setDisplay in drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php
Set the display as current.

File

drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php, line 631
Definition of Drupal\views\ViewExecutable.

Class

ViewExecutable
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.

Namespace

Drupal\views

Code

public function chooseDisplay($displays) {
  if (!is_array($displays)) {
    return $displays;
  }
  $this
    ->initDisplay();
  foreach ($displays as $display_id) {
    if ($this->displayHandlers[$display_id]
      ->access()) {
      return $display_id;
    }
  }
  return 'default';
}