You are here

function views_plugin_display_default::execute in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_display_default.inc \views_plugin_display_default::execute()
  2. 7.3 plugins/views_plugin_display_default.inc \views_plugin_display_default::execute()

The default execute handler fully renders the view.

For the simplest use:

$output = $view
  ->execute_display('default', $args);

For more complex usages, a view can be partially built:

$view
  ->set_arguments($args);
$view
  ->build('default');

// Build the query
$view
  ->execute();

// Run the query
$output = $view
  ->render();

// Render the view

If short circuited at any point, look in $view->build_info for information about the query. After execute, look in $view->result for the array of objects returned from db_query.

You can also do:

$view
  ->set_arguments($args);
$output = $view
  ->render('default');

// Render the view

This illustrates that render is smart enough to call build and execute if these items have not already been accomplished.

Note that execute also must accomplish other tasks, such as setting page titles, breadcrumbs, and generating exposed filter data if necessary.

Overrides views_plugin_display::execute

File

plugins/views_plugin_display_default.inc, line 52
Contains the default display plugin.

Class

views_plugin_display_default
A plugin to handle defaults on a view.

Code

function execute() {
  return $this->view
    ->render($this->display->id);
}