array( 'left_table' => 'user_titles_users', 'left_field' => 'tid', 'field' => 'tid', ), // user_titles links to node_revisions through user_titles_users via tid. 'node_revisions' => array( 'left_table' => 'user_titles_users', 'left_field' => 'tid', 'field' => 'tid', ), // user_titles links to users through user_titles_users via tid. 'users' => array( 'left_table' => 'user_titles_users', 'left_field' => 'tid', 'field' => 'tid', ), ); $data['user_titles_users']['table']['group'] = t('User titles'); $data['user_titles_users']['table']['join'] = array( 'user_titles' => array( 'left_field' => 'tid', 'field' => 'tid', ), 'users' => array( 'left_field' => 'uid', 'field' => 'uid', ), 'node' => array( 'left_field' => 'uid', 'field' => 'uid', ), 'node_revisions' => array( 'left_field' => 'uid', 'field' => 'uid', ), ); // Describe the title column of the user_titles table. $data['user_titles']['title'] = array( 'title' => t('Title'), 'help' => t("A user's current title."), 'field' => array( 'handler' => 'views_handler_field', 'click sortable' => TRUE, ), 'argument' => array( 'handler' => 'views_handler_argument_string', 'help' => t('User title.'), // 'many to one' => TRUE, 'empty field name' => t('No title'), ), 'sort' => array( 'handler' => 'views_handler_sort', ), ); $data['user_titles']['tid'] = array( 'title' => t('Title'), 'help' => t("A user's current title ID."), 'filter' => array( 'title' => t('Title'), 'handler' => 'views_handler_filter_user_title_tid', 'numeric' => TRUE, 'allow empty' => TRUE, ), ); // Describe the image column of the user_titles table. $data['user_titles']['image'] = array( 'title' => t('Title image'), 'help' => t("A user's current title image."), // The help that appears on the UI, 'field' => array( 'handler' => 'views_handler_field_user_titles_image', 'click sortable' => TRUE, ), /* 'filter' => array( 'handler' => 'views_handler_filter_numeric', ), */ 'sort' => array( 'handler' => 'views_handler_sort_user_titles_image', ), ); return $data; } /** * Implementation of hook_views_handlers() */ function user_titles_views_handlers() { return array( 'info' => array( 'path' => drupal_get_path('module', 'ut_views'), ), 'handlers' => array( // field handlers 'views_handler_field_user_title_image' => array( 'parent' => 'views_handler_field', ), // filter handlers 'views_handler_filter_user_title_tid' => array( 'parent' => 'views_handler_filter_many_to_one', ), // sort handlers 'views_handler_sort_user_title_image' => array( 'parent' => 'views_handler_sort', ), ), ); } /** * Implementation of hook_views_plugins() */ function user_titles_views_plugins() { return array( 'module' => 'ut_views', 'argument validator' => array( 'user_title' => array( 'title' => t('User title'), 'handler' => 'views_plugin_argument_validate_user_title', 'path' => drupal_get_path('module', 'ut_views'), ), ), ); }