Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ViewExecutable.php

function ViewExecutable::chooseDisplay

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

3 calls to ViewExecutable::chooseDisplay()
ViewExecutable::buildRenderable in core/modules/views/src/ViewExecutable.php
Builds the render array outline for the given display.
ViewExecutable::executeDisplay in core/modules/views/src/ViewExecutable.php
Executes the given display, with the given arguments.
ViewExecutable::setDisplay in core/modules/views/src/ViewExecutable.php
Sets the current display.

File

core/modules/views/src/ViewExecutable.php, line 800

Class

ViewExecutable
Represents a view as a whole.

Namespace

Drupal\views

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal