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