/[drupal]/contributions/modules/views/modules/profile.views_convert.inc
ViewVC logotype

Contents of /contributions/modules/views/modules/profile.views_convert.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Tue Jun 30 19:14:27 2009 UTC (4 months, 4 weeks ago) by merlinofchaos
Branch: MAIN
CVS Tags: DRUPAL-6--2-7, HEAD
Branch point for: DRUPAL-6--2, DRUPAL-7--3
Changes since 1.1: +1 -4 lines
File MIME type: text/x-php
More Views convert updates from Darren Oh
1 <?php
2 // $Id: profile.views_convert.inc,v 1.1 2009/06/03 19:06:05 merlinofchaos Exp $
3
4 /**
5 * @file
6 * Field conversion for fields handled by this module.
7 */
8
9 /**
10 * Implementation of hook_views_convert().
11 *
12 * Intervene to convert field values from the Views 1 format to the
13 * Views 2 format. Intervene only if $view->add_item() won't produce
14 * the right results, usually needed to set field options or values.
15 */
16 function profile_views_convert($display, $type, &$view, $field, $id = NULL) {
17 static $profile_fields;
18 if (!isset($profile_fields)) {
19 $profile_fields = array();
20 foreach (profile_views_get_fields() as $profile_field) {
21 $profile_fields['profile_values_'. $profile_field->name] = $profile_field;
22 }
23 }
24 switch ($type) {
25 case 'filter':
26 if (isset($tables[$field['tablename']])) {
27 switch ($profile_fields[$field['tablename']]->type) {
28 case 'vocabulary':
29 case 'selection':
30 $operators = array('AND' => 'in', 'OR' => 'in', 'NOR' => 'not in');
31 $view->set_item_option($display, 'filter', $id, 'operator', $operators[$field['operator']]);
32 break;
33 default:
34 $view->set_item_option($display, 'filter', $id, 'operator', $field['operator']);
35 break;
36 }
37 }
38 break;
39 }
40 }

  ViewVC Help
Powered by ViewVC 1.1.2