|
|
Drupal example source code file (user.views_convert.inc)
The user.views_convert.inc Drupal example source code<?php // $Id: user.views_convert.inc,v 1.3.4.1 2009/11/02 22:01:26 merlinofchaos Exp $ /** * @file * Field conversion for fields handled by this module. */ /** * Implements hook_views_convert(). */ function user_views_convert($display, $type, &$view, $field, $id = NULL) { switch ($type) { case 'field': switch ($field['tablename']) { case 'users': switch ($field['field']) { case 'uid': $view->set_item_option($display, 'field', $id, 'field', 'picture'); break; } break; } break; case 'filter': if ($field['tablename'] == 'users' || !strncmp($field['tablename'], 'users_role_', 11)) { switch ($field['field']) { case 'uid': $operators = array('OR' => 'IN', 'NOR' => 'NOT IN'); $view->set_item_option($display, 'filter', $id, 'operator', $operators[$field['operator']]); if ($rid = (integer) substr($field['tablename'], 11)) { $view->add_item($display, 'filter', 'users_roles', 'rid', array('value' => $rid)); } break; } } elseif ($field['tablename'] == 'users_roles') { switch ($field['field']) { case 'rid': $operators = array('AND' => 'and', 'OR' => 'or', 'NOR' => 'not'); $view->set_item_option($display, 'filter', $id, 'operator', $operators[$field['operator']]); break; } } break; case 'argument': $options = $field['argoptions']; switch ($field['type']) { case 'uid': $view->add_item($display, 'argument', 'users', 'uid', $options, $field['id']); break; case 'uidtouch': $view->add_item($display, 'argument', 'node', 'uid_touch', $options, $field['id']); break; case 'username': $view->add_item($display, 'argument', 'users', 'name', $options, $field['id']); break; } break; } } Other Drupal examples (source code examples)Here is a short list of links related to this Drupal user.views_convert.inc source code file: |
"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.