1 | <?php |
---|
2 | /** |
---|
3 | * @file |
---|
4 | * Contains the default display plugin. |
---|
5 | */ |
---|
6 | |
---|
7 | /** |
---|
8 | * A plugin to handle defaults on a view. |
---|
9 | * |
---|
10 | * @ingroup views_display_plugins |
---|
11 | */ |
---|
12 | class views_plugin_display_default extends views_plugin_display { |
---|
13 | /** |
---|
14 | * Determine if this display is the 'default' display which contains |
---|
15 | * fallback settings |
---|
16 | */ |
---|
17 | function is_default_display() { return TRUE; } |
---|
18 | |
---|
19 | /** |
---|
20 | * The default execute handler fully renders the view. |
---|
21 | * |
---|
22 | * For the simplest use: |
---|
23 | * @code |
---|
24 | * $output = $view->execute_display('default', $args); |
---|
25 | * @endcode |
---|
26 | * |
---|
27 | * For more complex usages, a view can be partially built: |
---|
28 | * @code |
---|
29 | * $view->set_arguments($args); |
---|
30 | * $view->build('default'); // Build the query |
---|
31 | * $view->execute(); // Run the query |
---|
32 | * $output = $view->render(); // Render the view |
---|
33 | * @endcode |
---|
34 | * |
---|
35 | * If short circuited at any point, look in $view->build_info for |
---|
36 | * information about the query. After execute, look in $view->result |
---|
37 | * for the array of objects returned from db_query. |
---|
38 | * |
---|
39 | * You can also do: |
---|
40 | * @code |
---|
41 | * $view->set_arguments($args); |
---|
42 | * $output = $view->render('default'); // Render the view |
---|
43 | * @endcode |
---|
44 | * |
---|
45 | * This illustrates that render is smart enough to call build and execute |
---|
46 | * if these items have not already been accomplished. |
---|
47 | * |
---|
48 | * Note that execute also must accomplish other tasks, such |
---|
49 | * as setting page titles, breadcrumbs, and generating exposed filter |
---|
50 | * data if necessary. |
---|
51 | */ |
---|
52 | function execute() { |
---|
53 | return $this->view->render($this->display->id); |
---|
54 | } |
---|
55 | } |
---|