public function ViewExecutable::setDisplay

Set the display as current.

Parameters

$display_id: The id of the display to mark as current.

12 calls to ViewExecutable::setDisplay()
ViewExecutable::addItem in drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php
Adds an instance of a handler to the view.
ViewExecutable::build in drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php
Build the query for the view.
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::executeHookBlockList in drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php
Called to get hook_block information from the view and the named display handler.
ViewExecutable::executeHookMenu in drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php
Called to get hook_menu() information from the view and the named display handler.

... See full list

File

drupal/core/modules/views/lib/Drupal/views/ViewExecutable.php, line 653
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 setDisplay($display_id = NULL) {

  // If we have not already initialized the display, do so. But be careful.
  if (empty($this->current_display)) {
    $this
      ->initDisplay();

    // If handlers were not initialized, and no argument was sent, set up
    // to the default display.
    if (empty($display_id)) {
      $display_id = 'default';
    }
  }
  $display_id = $this
    ->chooseDisplay($display_id);

  // If no display id sent in and one wasn't chosen above, we're finished.
  if (empty($display_id)) {
    return FALSE;
  }

  // Ensure the requested display exists.
  if (empty($this->displayHandlers[$display_id])) {
    $display_id = 'default';
    if (empty($this->displayHandlers[$display_id])) {
      debug(format_string('set_display() called with invalid display ID @display.', array(
        '@display' => $display_id,
      )));
      return FALSE;
    }
  }

  // Set the current display.
  $this->current_display = $display_id;

  // Ensure requested display has a working handler.
  if (empty($this->displayHandlers[$display_id])) {
    return FALSE;
  }

  // Set a shortcut
  $this->display_handler = $this->displayHandlers[$display_id];
  return TRUE;
}