home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (profile.views_convert.inc)

This example Drupal source code file (profile.views_convert.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

break, case, display, filter, foreach, function, id, in, isset, operators, php, profile_fields, switch, type

The profile.views_convert.inc Drupal example source code

// $Id: profile.views_convert.inc,v 2009/11/02 22:01:26 merlinofchaos Exp $

 * @file
 * Field conversion for fields handled by this module.

 * Implements hook_views_convert().
 * Intervene to convert field values from the Views 1 format to the
 * Views 2 format. Intervene only if $view->add_item() won't produce
 * the right results, usually needed to set field options or values.
function profile_views_convert($display, $type, &$view, $field, $id = NULL) {
  static $profile_fields;
  if (!isset($profile_fields)) {
    $profile_fields = array();
    foreach (profile_views_get_fields() as $profile_field) {
      $profile_fields['profile_values_'. $profile_field->name] = $profile_field;
  switch ($type) {
    case 'filter':
      if (isset($tables[$field['tablename']])) {
        switch ($profile_fields[$field['tablename']]->type) {
          case 'vocabulary':
          case 'selection':
            $operators = array('AND' => 'in', 'OR' => 'in', 'NOR' => 'not in');
            $view->set_item_option($display, 'filter', $id, 'operator', $operators[$field['operator']]);
            $view->set_item_option($display, 'filter', $id, 'operator', $field['operator']);

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal profile.views_convert.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.