function flag_views_data in Flag 7.3
Same name and namespace in other branches
- 8.4 flag.views.inc \flag_views_data()
- 6.2 includes/flag.views.inc \flag_views_data()
- 6 includes/flag.views.inc \flag_views_data()
- 7.2 includes/flag.views.inc \flag_views_data()
Implements hook_views_data().
File
- includes/
views/ flag.views.inc, line 35 - Provides support for the Views module.
Code
function flag_views_data() {
$data = array();
$data['flagging']['table']['group'] = t('Flags');
$data['flag_counts']['table']['group'] = t('Flags');
// Notify views from flag 2.x of our changes to views data.
// @see flag_update_7301().
$data['flag_content']['moved to'] = 'flagging';
// @see flag_update_7303().
$data['flag_content']['content_id']['moved to'] = array(
'flagging',
'entity_id',
);
$data['flagging']['uid'] = array(
'title' => t('User uid'),
'help' => t('The user that flagged an item. If you need more fields than the uid add the "Flags: User" relationship.'),
'relationship' => array(
'base' => 'users',
'title' => t('User'),
'help' => t('Relate an item to the user that flagged it.'),
'handler' => 'views_handler_relationship',
'label' => t('Flag user'),
),
'filter' => array(
'handler' => 'views_handler_filter_user_name',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'field' => array(
'handler' => 'views_handler_field_user',
),
);
$data['flagging']['timestamp'] = array(
'title' => t('Flagged time'),
'help' => t('Display the time the content was flagged by a user.'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
'argument' => array(
'handler' => 'views_handler_argument_date',
),
);
// Argument for content ID, used for "Who's flagged this" views.
$data['flagging']['entity_id'] = array(
'title' => t('Entity ID'),
'help' => t('The unique ID of the object that has been flagged.'),
'argument' => array(
'handler' => 'flag_handler_argument_entity_id',
),
);
// Specialized is null/is not null filter.
$data['flagging']['flagged'] = array(
'title' => t('Flagged'),
'real field' => 'uid',
'field' => array(
'handler' => 'flag_handler_field_flagged',
'label' => t('Flagged'),
'help' => t('A boolean field to show whether the flag is set or not.'),
),
'filter' => array(
'handler' => 'flag_handler_filter_flagged',
'label' => t('Flagged'),
'help' => t('Filter to ensure content has or has not been flagged.'),
),
'sort' => array(
'handler' => 'flag_handler_sort_flagged',
'label' => t('Flagged'),
'help' => t('Sort by whether entities have or have not been flagged.'),
),
);
// Flag content links.
$data['flagging']['ops'] = array(
'title' => t('Flag link'),
'help' => t('Display flag/unflag link.'),
'field' => array(
'handler' => 'flag_handler_field_ops',
),
);
$data['flagging']['sid'] = array(
'title' => t('Flagging session ID'),
'help' => t('The session ID of the flagging.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
);
$data['flagging']['flagging_id'] = array(
'title' => t('Flagging ID'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
'help' => t('Display the flagging ID.'),
),
'sort' => array(
'handler' => 'views_handler_sort',
'help' => t('Sort by the flagging ID.'),
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
'help' => t('Filter by the flagging ID.'),
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
'help' => t('The unique ID of the flagging.'),
),
);
$data['flag_counts']['count'] = array(
'title' => t('Flag counter'),
'help' => t('The number of times a piece of content is flagged by any user.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
);
$data['flag_counts']['last_updated'] = array(
'title' => t('Time last flagged'),
'help' => t('The time a piece of content was most recently flagged by any user.'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
'argument' => array(
'handler' => 'views_handler_argument_date',
),
);
return $data;
}