@@ -16,62 +16,62 @@ discard block |
||
16 | 16 | * Implementation of hook_views_handlers(). |
17 | 17 | */ |
18 | 18 | function content_views_handlers() { |
19 | - return array( |
|
19 | + return array( |
|
20 | 20 | 'info' => array( |
21 | - 'path' => drupal_get_path('module', 'content') . '/includes/views/handlers', |
|
21 | + 'path' => drupal_get_path('module', 'content') . '/includes/views/handlers', |
|
22 | 22 | ), |
23 | 23 | 'handlers' => array( |
24 | 24 | |
25 | - // argument handlers |
|
26 | - 'content_handler_argument' => array( |
|
25 | + // argument handlers |
|
26 | + 'content_handler_argument' => array( |
|
27 | 27 | 'parent' => 'views_handler_argument', |
28 | - ), |
|
29 | - 'content_handler_argument_string' => array( |
|
28 | + ), |
|
29 | + 'content_handler_argument_string' => array( |
|
30 | 30 | 'parent' => 'views_handler_argument_string', |
31 | - ), |
|
32 | - 'content_handler_argument_numeric' => array( |
|
31 | + ), |
|
32 | + 'content_handler_argument_numeric' => array( |
|
33 | 33 | 'parent' => 'views_handler_argument_numeric', |
34 | - ), |
|
35 | - 'content_handler_argument_reference' => array( |
|
34 | + ), |
|
35 | + 'content_handler_argument_reference' => array( |
|
36 | 36 | 'parent' => 'content_handler_argument_numeric', |
37 | - ), |
|
38 | - 'content_handler_argument_many_to_one' => array( |
|
37 | + ), |
|
38 | + 'content_handler_argument_many_to_one' => array( |
|
39 | 39 | 'parent' => 'views_handler_argument_many_to_one', |
40 | - ), |
|
40 | + ), |
|
41 | 41 | |
42 | - // field handlers |
|
43 | - 'content_handler_field' => array( |
|
42 | + // field handlers |
|
43 | + 'content_handler_field' => array( |
|
44 | 44 | 'parent' => 'views_handler_field_node', |
45 | - ), |
|
46 | - 'content_handler_field_multiple' => array( |
|
45 | + ), |
|
46 | + 'content_handler_field_multiple' => array( |
|
47 | 47 | 'parent' => 'content_handler_field', |
48 | - ), |
|
48 | + ), |
|
49 | 49 | |
50 | - // filter handlers |
|
51 | - 'content_handler_filter_string' => array( |
|
50 | + // filter handlers |
|
51 | + 'content_handler_filter_string' => array( |
|
52 | 52 | 'parent' => 'views_handler_filter_string', |
53 | - ), |
|
54 | - 'content_handler_filter_numeric' => array( |
|
53 | + ), |
|
54 | + 'content_handler_filter_numeric' => array( |
|
55 | 55 | 'parent' => 'views_handler_filter_numeric', |
56 | - ), |
|
57 | - 'content_handler_filter_float' => array( |
|
56 | + ), |
|
57 | + 'content_handler_filter_float' => array( |
|
58 | 58 | 'parent' => 'views_handler_filter_float', |
59 | - ), |
|
60 | - 'content_handler_filter_many_to_one' => array( |
|
59 | + ), |
|
60 | + 'content_handler_filter_many_to_one' => array( |
|
61 | 61 | 'parent' => 'views_handler_filter_many_to_one', |
62 | - ), |
|
62 | + ), |
|
63 | 63 | |
64 | - // relationship handlers |
|
65 | - 'content_handler_relationship' => array( |
|
64 | + // relationship handlers |
|
65 | + 'content_handler_relationship' => array( |
|
66 | 66 | 'parent' => 'views_handler_relationship', |
67 | - ), |
|
67 | + ), |
|
68 | 68 | |
69 | - // sort handlers |
|
70 | - 'content_handler_sort' => array( |
|
69 | + // sort handlers |
|
70 | + 'content_handler_sort' => array( |
|
71 | 71 | 'parent' => 'views_handler_sort', |
72 | - ), |
|
72 | + ), |
|
73 | 73 | ), |
74 | - ); |
|
74 | + ); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * nodereference and userreference. |
82 | 82 | */ |
83 | 83 | function content_views_plugins() { |
84 | - $plugins = array( |
|
84 | + $plugins = array( |
|
85 | 85 | 'module' => 'content', // This just tells our themes are elsewhere. |
86 | 86 | 'display' => array( |
87 | - 'content_simple' => array( |
|
87 | + 'content_simple' => array( |
|
88 | 88 | 'path' => drupal_get_path('module', 'content') . '/includes/views/handlers', |
89 | 89 | // Those strings are not translated for now. |
90 | 90 | // We'll need to change that if / when we remove 'no ui' |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | 'use ajax' => FALSE, |
97 | 97 | 'use pager' => FALSE, |
98 | 98 | 'accept attachments' => FALSE, |
99 | - ), |
|
100 | - 'content_references' => array( |
|
99 | + ), |
|
100 | + 'content_references' => array( |
|
101 | 101 | 'path' => drupal_get_path('module', 'content') . '/includes/views/handlers', |
102 | 102 | // Those strings are not translated for now. |
103 | 103 | // We'll need to change that if / when we remove 'no ui' |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | 'use ajax' => FALSE, |
111 | 111 | 'use pager' => FALSE, |
112 | 112 | 'accept attachments' => FALSE, |
113 | - ), |
|
113 | + ), |
|
114 | 114 | ), |
115 | 115 | 'style' => array( |
116 | - 'content_php_array_autocomplete' => array( |
|
116 | + 'content_php_array_autocomplete' => array( |
|
117 | 117 | 'path' => drupal_get_path('module', 'content') . '/includes/views/handlers', |
118 | 118 | // Those strings are not translated for now. |
119 | 119 | // We'll need to change that if / when we remove 'no ui' |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | 'uses fields' => TRUE, |
126 | 126 | 'type' => 'content_simple', |
127 | 127 | 'even empty' => TRUE, |
128 | - ), |
|
128 | + ), |
|
129 | 129 | ), |
130 | - ); |
|
131 | - return $plugins; |
|
130 | + ); |
|
131 | + return $plugins; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -137,187 +137,187 @@ discard block |
||
137 | 137 | * Exposes all fields to the views system. |
138 | 138 | */ |
139 | 139 | function content_views_data() { |
140 | - $data = array(); |
|
141 | - foreach (content_fields() as $field) { |
|
140 | + $data = array(); |
|
141 | + foreach (content_fields() as $field) { |
|
142 | 142 | $module = $field['module']; |
143 | 143 | $result = (array) module_invoke($module, 'field_settings', 'views data', $field); |
144 | 144 | drupal_alter('field_settings', $result, 'views data', $field); |
145 | 145 | if (empty($result)) { |
146 | - $result = content_views_field_views_data($field); |
|
146 | + $result = content_views_field_views_data($field); |
|
147 | 147 | } |
148 | 148 | if (is_array($result)) { |
149 | - $data = array_merge($data, $result); |
|
149 | + $data = array_merge($data, $result); |
|
150 | + } |
|
150 | 151 | } |
151 | - } |
|
152 | - return $data; |
|
152 | + return $data; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
156 | 156 | function content_views_field_views_data($field) { |
157 | - $field_types = _content_field_types(); |
|
157 | + $field_types = _content_field_types(); |
|
158 | 158 | |
159 | - // Check the field module is available. |
|
160 | - // TODO: is this really how we should do it ? |
|
161 | - if (isset($field_types[$field['type']])) { |
|
159 | + // Check the field module is available. |
|
160 | + // TODO: is this really how we should do it ? |
|
161 | + if (isset($field_types[$field['type']])) { |
|
162 | 162 | $db_info = content_database_info($field); |
163 | 163 | |
164 | 164 | // Field modules that do not store data in the database |
165 | 165 | // should not create views data tables. |
166 | 166 | if (empty($db_info['columns'])) { |
167 | - return; |
|
167 | + return; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $table_alias = content_views_tablename($field); |
171 | 171 | |
172 | 172 | $types = array(); |
173 | 173 | foreach (content_types() as $type) { |
174 | - if (isset($type['fields'][$field['field_name']])) { |
|
174 | + if (isset($type['fields'][$field['field_name']])) { |
|
175 | 175 | // TODO : run check_plain here instead of on the imploded string below ? |
176 | 176 | $types[] = $type['name']; |
177 | - } |
|
177 | + } |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $data = array(); |
181 | 181 | $data['table']['group'] = t('Content'); |
182 | 182 | $data['table']['join']['node'] = array( |
183 | - 'table' => $db_info['table'], |
|
184 | - 'left_field' => 'vid', |
|
185 | - 'field' => 'vid', |
|
183 | + 'table' => $db_info['table'], |
|
184 | + 'left_field' => 'vid', |
|
185 | + 'field' => 'vid', |
|
186 | 186 | ); |
187 | 187 | $data['table']['join']['node_revisions'] = array( |
188 | - 'table' => $db_info['table'], |
|
189 | - 'left_field' => 'vid', |
|
190 | - 'field' => 'vid', |
|
188 | + 'table' => $db_info['table'], |
|
189 | + 'left_field' => 'vid', |
|
190 | + 'field' => 'vid', |
|
191 | 191 | ); |
192 | 192 | |
193 | 193 | // Build the list of columns enabled for default views integration. |
194 | 194 | $db_columns = array(); |
195 | 195 | $additional_fields = array(); |
196 | 196 | foreach ($db_info['columns'] as $column => $attributes) { |
197 | - // Select explicitly enabled field columns. |
|
198 | - if (!empty($attributes['views'])) { |
|
197 | + // Select explicitly enabled field columns. |
|
198 | + if (!empty($attributes['views'])) { |
|
199 | 199 | $db_columns[$column] = $attributes; |
200 | - } |
|
201 | - // Ensure all columns are retrieved. |
|
202 | - $additional_fields[$attributes['column']] = $attributes['column']; |
|
200 | + } |
|
201 | + // Ensure all columns are retrieved. |
|
202 | + $additional_fields[$attributes['column']] = $attributes['column']; |
|
203 | 203 | } |
204 | 204 | // Pick up the first column when none has been explicitly enabled |
205 | 205 | // (pre CCK 2.2 backwards compatibility). |
206 | 206 | if (empty($db_columns)) { |
207 | - // Can't use array_slice(), it won't work in PHP4 for assoc array. |
|
208 | - foreach ($db_info['columns'] as $column => $attributes) { |
|
207 | + // Can't use array_slice(), it won't work in PHP4 for assoc array. |
|
208 | + foreach ($db_info['columns'] as $column => $attributes) { |
|
209 | 209 | $db_columns[$column] = $attributes; |
210 | 210 | break; |
211 | - } |
|
211 | + } |
|
212 | 212 | } |
213 | 213 | $columns = array(); |
214 | 214 | $db_fields = array(); |
215 | 215 | $arguments = array(); |
216 | 216 | $filters = array(); |
217 | 217 | foreach ($db_columns as $column => $attributes) { |
218 | - $columns[] = $column; |
|
219 | - $db_fields[] = $attributes['column']; |
|
220 | - $sorts[] = !empty($attributes['sortable']) ? TRUE : FALSE; |
|
218 | + $columns[] = $column; |
|
219 | + $db_fields[] = $attributes['column']; |
|
220 | + $sorts[] = !empty($attributes['sortable']) ? TRUE : FALSE; |
|
221 | 221 | |
222 | - // Identify likely filters and arguments for each column based on field type. |
|
223 | - switch ($attributes['type']) { |
|
222 | + // Identify likely filters and arguments for each column based on field type. |
|
223 | + switch ($attributes['type']) { |
|
224 | 224 | case 'int': |
225 | 225 | case 'mediumint': |
226 | 226 | case 'tinyint': |
227 | 227 | case 'bigint': |
228 | 228 | case 'serial': |
229 | 229 | $filters[] = 'content_handler_filter_numeric'; |
230 | - $arguments[] = 'content_handler_argument_numeric'; |
|
231 | - break; |
|
230 | + $arguments[] = 'content_handler_argument_numeric'; |
|
231 | + break; |
|
232 | 232 | case 'numeric': |
233 | 233 | case 'float': |
234 | 234 | $filters[] = 'content_handler_filter_float'; |
235 | - $arguments[] = 'content_handler_argument_numeric'; |
|
236 | - break; |
|
235 | + $arguments[] = 'content_handler_argument_numeric'; |
|
236 | + break; |
|
237 | 237 | |
238 | 238 | case 'text': |
239 | 239 | case 'blob': |
240 | 240 | // TODO add markup handlers for these types |
241 | 241 | default: |
242 | 242 | $filters[] = 'content_handler_filter_string'; |
243 | - $arguments[] = 'content_handler_argument_string'; |
|
244 | - break; |
|
245 | - } |
|
243 | + $arguments[] = 'content_handler_argument_string'; |
|
244 | + break; |
|
245 | + } |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | // Provide automatic filters, sorts, and arguments for each column, not just the first. |
249 | 249 | $db_fields_count = count($db_fields); |
250 | 250 | foreach ($db_fields as $i => $db_field) { |
251 | - $label_truncated = truncate_utf8(t($field['widget']['label']), 10, TRUE); |
|
252 | - if ($db_fields_count == 1) { |
|
251 | + $label_truncated = truncate_utf8(t($field['widget']['label']), 10, TRUE); |
|
252 | + if ($db_fields_count == 1) { |
|
253 | 253 | $title = t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])); |
254 | 254 | $title_short = check_plain($label_truncated); |
255 | - } |
|
256 | - else { |
|
255 | + } |
|
256 | + else { |
|
257 | 257 | $title = t('@label (!name) - !column', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'], '!column' => $columns[$i])); |
258 | 258 | $title_short = t('@label-truncated - !column', array('@label-truncated' => $label_truncated, '!column' => $columns[$i])); |
259 | - } |
|
259 | + } |
|
260 | 260 | |
261 | - $data[$db_field] = array( |
|
261 | + $data[$db_field] = array( |
|
262 | 262 | 'group' => t('Content'), |
263 | 263 | 'title' => $title, |
264 | 264 | 'title short' => $title_short, |
265 | 265 | 'help' => t($field_types[$field['type']]['label']) .' - '. t('Appears in: @types', array('@types' => implode(', ', $types))), |
266 | - ); |
|
267 | - if ($i == 0) { |
|
266 | + ); |
|
267 | + if ($i == 0) { |
|
268 | 268 | $data[$db_field]['field'] = array( |
269 | - 'title' => t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])), |
|
270 | - 'title short' => check_plain($label_truncated), |
|
271 | - 'field' => $db_field, |
|
272 | - 'table' => $db_info['table'], |
|
273 | - 'handler' => 'content_handler_field_multiple', |
|
274 | - 'click sortable' => $sorts[$i], |
|
275 | - 'additional fields' => $additional_fields, |
|
276 | - 'content_field_name' => $field['field_name'], |
|
277 | - 'access callback' => 'content_access', |
|
278 | - 'access arguments' => array('view', $field), |
|
269 | + 'title' => t('@label (!name)', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])), |
|
270 | + 'title short' => check_plain($label_truncated), |
|
271 | + 'field' => $db_field, |
|
272 | + 'table' => $db_info['table'], |
|
273 | + 'handler' => 'content_handler_field_multiple', |
|
274 | + 'click sortable' => $sorts[$i], |
|
275 | + 'additional fields' => $additional_fields, |
|
276 | + 'content_field_name' => $field['field_name'], |
|
277 | + 'access callback' => 'content_access', |
|
278 | + 'access arguments' => array('view', $field), |
|
279 | 279 | ); |
280 | - } |
|
281 | - $data[$db_field]['argument'] = array( |
|
280 | + } |
|
281 | + $data[$db_field]['argument'] = array( |
|
282 | 282 | 'field' => $db_field, |
283 | 283 | 'table' => $db_info['table'], |
284 | 284 | 'handler' => $arguments[$i], |
285 | 285 | 'additional fields' => $additional_fields, |
286 | 286 | 'content_field_name' => $field['field_name'], |
287 | 287 | 'empty field name' => t('<No value>'), |
288 | - ); |
|
289 | - $data[$db_field]['filter'] = array( |
|
288 | + ); |
|
289 | + $data[$db_field]['filter'] = array( |
|
290 | 290 | 'field' => $db_field, |
291 | 291 | 'table' => $db_info['table'], |
292 | 292 | 'handler' => $filters[$i], |
293 | 293 | 'additional fields' => $additional_fields, |
294 | 294 | 'content_field_name' => $field['field_name'], |
295 | 295 | 'allow empty' => TRUE, |
296 | - ); |
|
297 | - if (!empty($sorts[$i])) { |
|
296 | + ); |
|
297 | + if (!empty($sorts[$i])) { |
|
298 | 298 | $data[$db_field]['sort'] = array( |
299 | - 'field' => $db_field, |
|
300 | - 'table' => $db_info['table'], |
|
301 | - 'handler' => 'content_handler_sort', |
|
302 | - 'additional fields' => $additional_fields, |
|
303 | - 'content_field_name' => $field['field_name'], |
|
299 | + 'field' => $db_field, |
|
300 | + 'table' => $db_info['table'], |
|
301 | + 'handler' => 'content_handler_sort', |
|
302 | + 'additional fields' => $additional_fields, |
|
303 | + 'content_field_name' => $field['field_name'], |
|
304 | 304 | ); |
305 | - } |
|
305 | + } |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | // Expose additional delta column for multiple value fields. |
309 | 309 | if ($field['multiple']) { |
310 | - $title = t('@label (!name) - delta', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])); |
|
311 | - $title_short = t('@label-truncated - delta', array('@label-truncated' => $label_truncated)); |
|
310 | + $title = t('@label (!name) - delta', array('@label' => t($field['widget']['label']), '!name' => $field['field_name'])); |
|
311 | + $title_short = t('@label-truncated - delta', array('@label-truncated' => $label_truncated)); |
|
312 | 312 | |
313 | - $db_field = 'delta'; |
|
314 | - $data[$db_field] = array( |
|
313 | + $db_field = 'delta'; |
|
314 | + $data[$db_field] = array( |
|
315 | 315 | 'group' => t('Content'), |
316 | 316 | 'title' => $title, |
317 | 317 | 'title short' => $title_short, |
318 | 318 | 'help' => t('Delta - Appears in: @types', array('@types' => implode(', ', $types))), |
319 | - ); |
|
320 | - $data[$db_field]['field'] = array( |
|
319 | + ); |
|
320 | + $data[$db_field]['field'] = array( |
|
321 | 321 | 'title' => $title, |
322 | 322 | 'title short' => $title_short, |
323 | 323 | 'field' => $db_field, |
@@ -327,31 +327,31 @@ discard block |
||
327 | 327 | 'additional fields' => $additional_fields, |
328 | 328 | 'access callback' => 'content_access', |
329 | 329 | 'access arguments' => array('view', $field), |
330 | - ); |
|
331 | - $data[$db_field]['argument'] = array( |
|
330 | + ); |
|
331 | + $data[$db_field]['argument'] = array( |
|
332 | 332 | 'field' => $db_field, |
333 | 333 | 'table' => $db_info['table'], |
334 | 334 | 'handler' => 'views_handler_argument_numeric', |
335 | 335 | 'additional fields' => $additional_fields, |
336 | 336 | 'empty field name' => t('<No value>'), |
337 | - ); |
|
338 | - $data[$db_field]['filter'] = array( |
|
337 | + ); |
|
338 | + $data[$db_field]['filter'] = array( |
|
339 | 339 | 'field' => $db_field, |
340 | 340 | 'table' => $db_info['table'], |
341 | 341 | 'handler' => 'views_handler_filter_numeric', |
342 | 342 | 'additional fields' => $additional_fields, |
343 | 343 | 'allow empty' => TRUE, |
344 | - ); |
|
345 | - $data[$db_field]['sort'] = array( |
|
344 | + ); |
|
345 | + $data[$db_field]['sort'] = array( |
|
346 | 346 | 'field' => $db_field, |
347 | 347 | 'table' => $db_info['table'], |
348 | 348 | 'handler' => 'views_handler_sort', |
349 | 349 | 'additional fields' => $additional_fields, |
350 | - ); |
|
350 | + ); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | return array($table_alias => $data); |
354 | - } |
|
354 | + } |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -359,17 +359,17 @@ discard block |
||
359 | 359 | * in the future without re-writing code. |
360 | 360 | */ |
361 | 361 | function content_views_tablename($field) { |
362 | - return 'node_data_'. $field['field_name']; |
|
362 | + return 'node_data_'. $field['field_name']; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | function theme_content_view_multiple_field($items, $field, $values) { |
366 | - $output = ''; |
|
367 | - $i = 0; |
|
368 | - foreach ($items as $item) { |
|
366 | + $output = ''; |
|
367 | + $i = 0; |
|
368 | + foreach ($items as $item) { |
|
369 | 369 | if (!empty($item) || $item == '0') { |
370 | - $output .= '<div class="field-item field-item-'. $i .'">'. $item .'</div>'; |
|
371 | - $i++; |
|
370 | + $output .= '<div class="field-item field-item-'. $i .'">'. $item .'</div>'; |
|
371 | + $i++; |
|
372 | + } |
|
372 | 373 | } |
373 | - } |
|
374 | - return $output; |
|
374 | + return $output; |
|
375 | 375 | } |
376 | 376 | \ No newline at end of file |
@@ -7,67 +7,67 @@ |
||
7 | 7 | * values by allowing the views administrator to select deltas. |
8 | 8 | */ |
9 | 9 | class content_handler_relationship extends views_handler_relationship { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | |
15 | 15 | $this->content_field = content_fields($this->definition['content_field_name']); |
16 | - } |
|
16 | + } |
|
17 | 17 | |
18 | - function option_definition() { |
|
18 | + function option_definition() { |
|
19 | 19 | $options = parent::option_definition(); |
20 | 20 | $options['delta'] = array('default' => -1); |
21 | 21 | |
22 | 22 | return $options; |
23 | - } |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Add a delta selector for multiple fields. |
|
27 | - */ |
|
28 | - function options_form(&$form, &$form_state) { |
|
25 | + /** |
|
26 | + * Add a delta selector for multiple fields. |
|
27 | + */ |
|
28 | + function options_form(&$form, &$form_state) { |
|
29 | 29 | $field = $this->content_field; |
30 | 30 | parent::options_form($form, $form_state); |
31 | 31 | |
32 | 32 | // Only add the form gadget if the field is multiple. |
33 | 33 | if ($field['multiple']) { |
34 | - $max_delta = $field['multiple']; |
|
35 | - // 1 means unlimited. |
|
36 | - if ($max_delta == 1) { |
|
34 | + $max_delta = $field['multiple']; |
|
35 | + // 1 means unlimited. |
|
36 | + if ($max_delta == 1) { |
|
37 | 37 | $max_delta = 10; |
38 | - } |
|
38 | + } |
|
39 | 39 | |
40 | - $options = array('-1' => t('All')); |
|
41 | - for ($i = 0; $i < $max_delta; $i++) { |
|
40 | + $options = array('-1' => t('All')); |
|
41 | + for ($i = 0; $i < $max_delta; $i++) { |
|
42 | 42 | $options[$i] = $i + 1; |
43 | - } |
|
44 | - $form['delta'] = array( |
|
43 | + } |
|
44 | + $form['delta'] = array( |
|
45 | 45 | '#type' => 'select', |
46 | 46 | '#options' => $options, |
47 | 47 | '#default_value' => $this->options['delta'], |
48 | 48 | '#title' => t('Delta'), |
49 | 49 | '#description' => t('The delta allows you to select which item in a multiple value field to key the relationship off of. Select "1" to use the first item, "2" for the second item, and so on. If you select "All", each item in the field will create a new row, which may appear to cause duplicates.'), |
50 | - ); |
|
50 | + ); |
|
51 | + } |
|
51 | 52 | } |
52 | - } |
|
53 | 53 | |
54 | - function ensure_my_table() { |
|
54 | + function ensure_my_table() { |
|
55 | 55 | if (!isset($this->table_alias)) { |
56 | - $join = $this->get_join(); |
|
57 | - if (!isset($join->extra)) { |
|
56 | + $join = $this->get_join(); |
|
57 | + if (!isset($join->extra)) { |
|
58 | 58 | $join->extra = array(); |
59 | - } |
|
60 | - $delta = isset($this->options['delta']) ? $this->options['delta'] : -1; |
|
61 | - if ($delta != -1) { |
|
59 | + } |
|
60 | + $delta = isset($this->options['delta']) ? $this->options['delta'] : -1; |
|
61 | + if ($delta != -1) { |
|
62 | 62 | $join->extra[] = array( |
63 | - 'field' => 'delta', |
|
64 | - 'value' => $delta, |
|
65 | - 'numeric' => TRUE, |
|
63 | + 'field' => 'delta', |
|
64 | + 'value' => $delta, |
|
65 | + 'numeric' => TRUE, |
|
66 | 66 | ); |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - $this->table_alias = $this->query->add_table($this->table, $this->relationship, $join); |
|
69 | + $this->table_alias = $this->query->add_table($this->table, $this->relationship, $join); |
|
70 | 70 | } |
71 | 71 | return $this->table_alias; |
72 | - } |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | \ No newline at end of file |
@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | * Provide handler to replace reference with title. |
7 | 7 | */ |
8 | 8 | class content_handler_argument_reference extends content_handler_argument_numeric { |
9 | - /** |
|
10 | - * Override the behavior of title(). |
|
11 | - */ |
|
12 | - function title_query() { |
|
9 | + /** |
|
10 | + * Override the behavior of title(). |
|
11 | + */ |
|
12 | + function title_query() { |
|
13 | 13 | $titles = array(); |
14 | 14 | $placeholders = implode(', ', array_fill(0, sizeof($this->value), '%d')); |
15 | 15 | |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | |
19 | 19 | $result = db_query("SELECT $this->name_field AS title FROM {". $table['table'] ."} WHERE ". $table['field'] ." IN ($placeholders)", $this->value); |
20 | 20 | while ($row = db_fetch_object($result)) { |
21 | - $titles[] = check_plain($row->title); |
|
21 | + $titles[] = check_plain($row->title); |
|
22 | 22 | } |
23 | 23 | return $titles; |
24 | - } |
|
24 | + } |
|
25 | 25 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * Handler for 'content_php_array_autocomplete' style. |
7 | 7 | */ |
8 | 8 | class content_plugin_style_php_array_ac extends views_plugin_style { |
9 | - function render() { |
|
9 | + function render() { |
|
10 | 10 | $results = array(); |
11 | 11 | |
12 | 12 | // Group the rows according to the grouping field, if specified. |
@@ -20,15 +20,15 @@ discard block |
||
20 | 20 | // Could be useful for select widget, though. |
21 | 21 | $this->view->row_index = 0; |
22 | 22 | foreach ($sets as $title => $records) { |
23 | - foreach ($records as $label => $row) { |
|
23 | + foreach ($records as $label => $row) { |
|
24 | 24 | $results[$row->{$base_field}] = array( |
25 | - 'title' => $row->{$title_field_alias}, |
|
26 | - 'rendered' => $this->row_plugin->render($row), |
|
25 | + 'title' => $row->{$title_field_alias}, |
|
26 | + 'rendered' => $this->row_plugin->render($row), |
|
27 | 27 | ); |
28 | 28 | $this->view->row_index++; |
29 | - } |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | unset($this->view->row_index); |
32 | 32 | return $results; |
33 | - } |
|
33 | + } |
|
34 | 34 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_argument_string extends views_handler_argument_string { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | |
15 | 15 | $this->content_field = content_fields($this->definition['content_field_name']); |
16 | 16 | $this->additional_fields = $this->definition['additional fields']; |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -7,12 +7,12 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_argument_numeric extends views_handler_argument_numeric { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | |
15 | 15 | $this->content_field = content_fields($this->definition['content_field_name']); |
16 | 16 | $this->additional_fields = $this->definition['additional fields']; |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -7,11 +7,11 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_filter_string extends views_handler_filter_string { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | $this->content_field = content_fields($this->definition['content_field_name']); |
15 | 15 | $this->additional_fields = $this->definition['additional fields']; |
16 | - } |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -7,68 +7,68 @@ |
||
7 | 7 | * values by allowing the views administrator to select deltas. |
8 | 8 | */ |
9 | 9 | class content_handler_sort extends views_handler_sort { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | |
15 | 15 | $this->content_field = content_fields($this->definition['content_field_name']); |
16 | 16 | $this->additional_fields = $this->definition['additional fields']; |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - function option_definition() { |
|
19 | + function option_definition() { |
|
20 | 20 | $options = parent::option_definition(); |
21 | 21 | $options['delta'] = array('default' => -1); |
22 | 22 | |
23 | 23 | return $options; |
24 | - } |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Add a delta selector for multiple fields. |
|
28 | - */ |
|
29 | - function options_form(&$form, &$form_state) { |
|
26 | + /** |
|
27 | + * Add a delta selector for multiple fields. |
|
28 | + */ |
|
29 | + function options_form(&$form, &$form_state) { |
|
30 | 30 | $field = $this->content_field; |
31 | 31 | parent::options_form($form, $form_state); |
32 | 32 | |
33 | 33 | // Only add the form gadget if the field is multiple. |
34 | 34 | if ($field['multiple']) { |
35 | - $max_delta = $field['multiple']; |
|
36 | - // 1 means unlimited. |
|
37 | - if ($max_delta == 1) { |
|
35 | + $max_delta = $field['multiple']; |
|
36 | + // 1 means unlimited. |
|
37 | + if ($max_delta == 1) { |
|
38 | 38 | $max_delta = 10; |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | - $options = array('-1' => t('All')); |
|
42 | - for ($i = 0; $i < $max_delta; $i++) { |
|
41 | + $options = array('-1' => t('All')); |
|
42 | + for ($i = 0; $i < $max_delta; $i++) { |
|
43 | 43 | $options[$i] = $i + 1; |
44 | - } |
|
45 | - $form['delta'] = array( |
|
44 | + } |
|
45 | + $form['delta'] = array( |
|
46 | 46 | '#type' => 'select', |
47 | 47 | '#options' => $options, |
48 | 48 | '#default_value' => $this->options['delta'], |
49 | 49 | '#title' => t('Delta'), |
50 | 50 | '#description' => t('The delta allows you to select which item in a multiple value field will be used for sorting. Select "1" to use the first item, "2" for the second item, and so on. If you select "All", each item in the field will create a new row, which may appear to cause duplicates.'), |
51 | - ); |
|
51 | + ); |
|
52 | + } |
|
52 | 53 | } |
53 | - } |
|
54 | 54 | |
55 | - function ensure_my_table() { |
|
55 | + function ensure_my_table() { |
|
56 | 56 | if (!isset($this->table_alias)) { |
57 | - $join = $this->get_join(); |
|
58 | - if (!isset($join->extra)) { |
|
57 | + $join = $this->get_join(); |
|
58 | + if (!isset($join->extra)) { |
|
59 | 59 | $join->extra = array(); |
60 | - } |
|
61 | - $delta = isset($this->options['delta']) ? $this->options['delta'] : -1; |
|
62 | - if ($delta != -1) { |
|
60 | + } |
|
61 | + $delta = isset($this->options['delta']) ? $this->options['delta'] : -1; |
|
62 | + if ($delta != -1) { |
|
63 | 63 | $join->extra[] = array( |
64 | - 'field' => 'delta', |
|
65 | - 'value' => $delta, |
|
66 | - 'numeric' => TRUE, |
|
64 | + 'field' => 'delta', |
|
65 | + 'value' => $delta, |
|
66 | + 'numeric' => TRUE, |
|
67 | 67 | ); |
68 | - } |
|
68 | + } |
|
69 | 69 | |
70 | - $this->table_alias = $this->query->ensure_table($this->table, $this->relationship, $join); |
|
70 | + $this->table_alias = $this->query->ensure_table($this->table, $this->relationship, $join); |
|
71 | 71 | } |
72 | 72 | return $this->table_alias; |
73 | - } |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -7,36 +7,36 @@ |
||
7 | 7 | * for field-specific subclasses to use if they need to. |
8 | 8 | */ |
9 | 9 | class content_handler_filter_many_to_one extends views_handler_filter_many_to_one { |
10 | - var $content_field; |
|
10 | + var $content_field; |
|
11 | 11 | |
12 | - function construct() { |
|
12 | + function construct() { |
|
13 | 13 | parent::construct(); |
14 | 14 | $this->content_field = content_fields($this->definition['content_field_name']); |
15 | 15 | $this->additional_fields = $this->definition['additional fields']; |
16 | 16 | $field = $this->content_field; |
17 | 17 | $this->value_title = $field['widget']['label']; |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | - function get_value_options() { |
|
20 | + function get_value_options() { |
|
21 | 21 | $this->value_options = $this->allowed_values(); |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | - // Get allowed values from hook_allowed_values(), if any, |
|
25 | - // or from content_allowed_values(); |
|
26 | - function allowed_values() { |
|
24 | + // Get allowed values from hook_allowed_values(), if any, |
|
25 | + // or from content_allowed_values(); |
|
26 | + function allowed_values() { |
|
27 | 27 | $field = $this->content_field; |
28 | 28 | $function = $field['module'] .'_allowed_values'; |
29 | 29 | if ($this->value_form_type == 'select') { |
30 | - // Select elements accept multidimensional arrays to support optgroups. |
|
31 | - $options = function_exists($function) ? $function($field) : content_allowed_values($field, FALSE); |
|
32 | - // For selects, HTML should be filtered out and entities left unencoded. |
|
33 | - // See content_allowed_values / content_filter_xss / filter_xss. |
|
34 | - content_allowed_values_filter_html($options); |
|
30 | + // Select elements accept multidimensional arrays to support optgroups. |
|
31 | + $options = function_exists($function) ? $function($field) : content_allowed_values($field, FALSE); |
|
32 | + // For selects, HTML should be filtered out and entities left unencoded. |
|
33 | + // See content_allowed_values / content_filter_xss / filter_xss. |
|
34 | + content_allowed_values_filter_html($options); |
|
35 | 35 | } |
36 | 36 | else { |
37 | - $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
|
37 | + $options = function_exists($function) ? $function($field) : content_allowed_values($field); |
|
38 | 38 | } |
39 | 39 | return (array) $options; |
40 | - } |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
43 | 43 | \ No newline at end of file |