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