'{flag_content}'); } /** * Implementation of hook_views_data(). */ function flag_views_data() { ....... // Advertise this table as a possible base table $data['flag_flagging']['table']['base'] = array( 'field' => 'content_id', 'title' => t('Flaggings'), 'help' => t('Get at the individual flaggings.'), 'numeric' => TRUE, ); $data['flag_flagging']['content_id'] = array( 'title' => t('Content ID'), 'help' => t('Filter the flaggings to those set on a certain content object.'), .... ); $data['flag_flagging']['fid'] = array( 'title' => t('Flag ID'), 'help' => t('Filter the flaggings to those of a certain flag.'), .... ); $data['flag_flagging']['ops'] = array( 'title' => t('Unflag link'), 'help' => t('Display the unflag link, for flaggings made by current user.'), .... ); $data['flag_flagging']['node_rel'] = array( 'title' => t('Node'), 'help' => t('The flagged node.'), 'relationship' => array( 'flag type' => 'node', 'base' => 'node', 'base field' => 'nid', 'relationship field' => 'content_id', 'handler' => 'flag_handler_relationship_filtered_content', 'label' => t('Flagged node'), ), ); $data['flag_flagging']['comment_rel'] = array( 'title' => t('Comment'), 'help' => t('The flagged comment.'), 'relationship' => array( 'flag type' => 'comment', 'base' => 'comments', 'base field' => 'cid', 'relationship field' => 'content_id', 'handler' => 'flag_handler_relationship_filtered_content', 'label' => t('Flagged comment'), ), ); $data['flag_flagging']['user_rel'] = array( 'title' => t('User'), 'help' => t('The flagged user.'), 'relationship' => array( 'flag type' => 'user', 'base' => 'users', 'base field' => 'uid', 'relationship field' => 'content_id', 'handler' => 'flag_handler_relationship_filtered_content', 'label' => t('Flagged user'), ), ); $data['flag_flagging']['uid'] = array( 'title' => t('User'), 'help' => t('The flagging user.'), 'relationship' => array( ... ), 'argument' => array( ... ), 'filter' => array( ... ), ); $data['flag_flagging']['timestamp'] = array( 'title' => t('Flagging time'), ... ); ....... } /** * Implementation of hook_views_data_alter(). */ function flag_views_data_alter(&$data) { ....... $data['users']['flaggings_rel'] = array( 'group' => t('Flagging'), 'title' => t('Flagging'), 'help' => t('Get at the individual flaggings of this user'), 'relationship' => array( 'handler' => 'views_handler_relationship', 'label' => t('flaggings'), 'base' => 'flag_flagging', 'base field' => 'uid', 'relationship field' => 'uid', ), ); ....... }