Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/handlers/views_handler_area.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* Views area handlers.
|
|
5 |
* Definition of views_handler_area and views_handler_area_broken.
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
... | ... | |
20 | 20 |
class views_handler_area extends views_handler { |
21 | 21 |
|
22 | 22 |
/** |
23 |
* Overrides views_handler::init(). |
|
24 |
* |
|
25 |
* Make sure that no result area handlers are set to be shown when the result |
|
26 |
* is empty. |
|
23 |
* {@inheritdoc} |
|
27 | 24 |
*/ |
28 |
function init(&$view, &$options) { |
|
25 |
public function init(&$view, &$options) {
|
|
29 | 26 |
parent::init($view, $options); |
27 |
// Make sure that no result area handlers are set to be shown when the |
|
28 |
// result is empty. |
|
30 | 29 |
if ($this->handler_type == 'empty') { |
31 | 30 |
$this->options['empty'] = TRUE; |
32 | 31 |
} |
33 | 32 |
} |
34 | 33 |
|
35 | 34 |
/** |
36 |
* Get this field's label.
|
|
35 |
* {@inheritdoc}
|
|
37 | 36 |
*/ |
38 |
function label() { |
|
37 |
public function label() {
|
|
39 | 38 |
if (!isset($this->options['label'])) { |
40 | 39 |
return $this->ui_name(); |
41 | 40 |
} |
42 | 41 |
return $this->options['label']; |
43 | 42 |
} |
44 | 43 |
|
45 |
function option_definition() { |
|
44 |
/** |
|
45 |
* {@inheritdoc} |
|
46 |
*/ |
|
47 |
public function option_definition() { |
|
46 | 48 |
$options = parent::option_definition(); |
47 | 49 |
|
48 | 50 |
$this->definition['field'] = !empty($this->definition['field']) ? $this->definition['field'] : ''; |
... | ... | |
54 | 56 |
} |
55 | 57 |
|
56 | 58 |
/** |
57 |
* Provide extra data to the administration form |
|
59 |
* Provide extra data to the administration form.
|
|
58 | 60 |
*/ |
59 |
function admin_summary() { |
|
61 |
public function admin_summary() {
|
|
60 | 62 |
return $this->label(); |
61 | 63 |
} |
62 | 64 |
|
63 | 65 |
/** |
64 |
* Default options form that provides the label widget that all fields |
|
65 |
* should have.
|
|
66 |
* Default options form that provides the label widget that all fields should
|
|
67 |
* have. |
|
66 | 68 |
*/ |
67 |
function options_form(&$form, &$form_state) { |
|
69 |
public function options_form(&$form, &$form_state) {
|
|
68 | 70 |
parent::options_form($form, $form_state); |
69 | 71 |
$form['label'] = array( |
70 | 72 |
'#type' => 'textfield', |
... | ... | |
83 | 85 |
} |
84 | 86 |
|
85 | 87 |
/** |
86 |
* Don't run a query |
|
88 |
* Don't run a query.
|
|
87 | 89 |
*/ |
88 |
function query() { } |
|
90 |
public function query() { |
|
91 |
} |
|
89 | 92 |
|
90 | 93 |
/** |
91 |
* Render the area |
|
94 |
* Render the area.
|
|
92 | 95 |
*/ |
93 |
function render($empty = FALSE) { |
|
96 |
public function render($empty = FALSE) {
|
|
94 | 97 |
return ''; |
95 | 98 |
} |
96 | 99 |
|
97 | 100 |
/** |
98 | 101 |
* Area handlers shouldn't have groupby. |
99 | 102 |
*/ |
100 |
function use_group_by() { |
|
103 |
public function use_group_by() {
|
|
101 | 104 |
return FALSE; |
102 | 105 |
} |
106 |
|
|
103 | 107 |
} |
104 | 108 |
|
105 | 109 |
/** |
... | ... | |
108 | 112 |
* @ingroup views_area_handlers |
109 | 113 |
*/ |
110 | 114 |
class views_handler_area_broken extends views_handler_area { |
111 |
function ui_name($short = FALSE) { |
|
115 |
|
|
116 |
/** |
|
117 |
* {@inheritdoc} |
|
118 |
*/ |
|
119 |
public function ui_name($short = FALSE) { |
|
112 | 120 |
return t('Broken/missing handler'); |
113 | 121 |
} |
114 | 122 |
|
115 |
function ensure_my_table() { /* No table to ensure! */ } |
|
116 |
function query($group_by = FALSE) { /* No query to run */ } |
|
117 |
function render($empty = FALSE) { return ''; } |
|
118 |
function options_form(&$form, &$form_state) { |
|
123 |
/** |
|
124 |
* {@inheritdoc} |
|
125 |
*/ |
|
126 |
public function ensure_my_table() { |
|
127 |
// No table to ensure! |
|
128 |
} |
|
129 |
|
|
130 |
/** |
|
131 |
* {@inheritdoc} |
|
132 |
*/ |
|
133 |
public function query($group_by = FALSE) { |
|
134 |
// No query to run. |
|
135 |
} |
|
136 |
|
|
137 |
/** |
|
138 |
* {@inheritdoc} |
|
139 |
*/ |
|
140 |
public function render($empty = FALSE) { |
|
141 |
return ''; |
|
142 |
} |
|
143 |
|
|
144 |
/** |
|
145 |
* {@inheritdoc} |
|
146 |
*/ |
|
147 |
public function options_form(&$form, &$form_state) { |
|
119 | 148 |
$form['markup'] = array( |
120 | 149 |
'#prefix' => '<div class="form-item description">', |
121 | 150 |
'#value' => t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.'), |
... | ... | |
123 | 152 |
} |
124 | 153 |
|
125 | 154 |
/** |
126 |
* Determine if the handler is considered 'broken'
|
|
155 |
* {@inheritdoc}
|
|
127 | 156 |
*/ |
128 |
function broken() { return TRUE; } |
|
157 |
public function broken() { |
|
158 |
return TRUE; |
|
159 |
} |
|
160 |
|
|
129 | 161 |
} |
130 | 162 |
|
131 | 163 |
/** |
Formats disponibles : Unified diff
Weekly update of contrib modules