[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/views/modules/ -> profile.views_convert.inc (source)

   1  <?php
   2  // $Id: profile.views_convert.inc,v 1.2 2009/06/30 19:14:27 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  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7