You are here

public function ViewExecutable::preview in Views (for Drupal 7) 8.3

Preview the given display, with the given arguments.

To be called externally, probably by an AJAX handler of some flavor. Can also be called when views are embedded, as this guarantees normalized output.

1 call to ViewExecutable::preview()
ViewUI::renderPreview in views_ui/lib/Drupal/views_ui/ViewUI.php

File

lib/Drupal/views/ViewExecutable.php, line 1399
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 preview($display_id = NULL, $args = array()) {
  if (empty($this->current_display) || !empty($display_id) && $this->current_display != $display_id) {
    if (!$this
      ->setDisplay($display_id)) {
      return FALSE;
    }
  }
  $this->preview = TRUE;
  $this
    ->preExecute($args);

  // Preview the view.
  $output = $this->display_handler
    ->preview();
  $this
    ->postExecute();
  return $output;
}