function heartbeat_views_data in Heartbeat 6.3
Same name and namespace in other branches
- 8 heartbeat.views.inc \heartbeat_views_data()
- 6.4 views/heartbeat_views.views.inc \heartbeat_views_data()
- 6.2 user_activity_views/user_activity_views.views.inc \heartbeat_views_data()
- 7 heartbeat.views.inc \heartbeat_views_data()
Implementation of views hook hook_views_data()
Return value
array views data
See also
http://blue.live4all.co.il/~mooffie/tmp/views_illustrated/
File
- views/
heartbeat_views.views.inc, line 10
Code
function heartbeat_views_data() {
$data = array(
'heartbeat_activity' => array(
// Table to join
'table' => array(
'group' => t('User activity log table'),
'base' => array(
'field' => 'uaid',
'title' => t('Heartbeat activities'),
'help' => t("User activities on the site"),
),
'join' => array(
'heartbeat_messages' => array(
'handler' => 'views_join',
// this is actually optional
'left_table' => 'heartbeat_activity',
// Because this is a direct link it could be left out.
'type' => 'INNER',
'left_field' => 'message_id',
'field' => 'message_id',
),
),
),
// Fields to use or as filter, arguments, ...
'uid' => array(
'title' => t('User'),
'help' => t('The user who carried out the activity'),
'relationship' => array(
'base' => 'users',
'field' => 'uid',
'handler' => 'views_handler_relationship',
'label' => t('User'),
),
),
'uid_current' => array(
'real field' => 'uid',
'title' => t('Currently logged in user carried out the activity'),
'help' => t('The user who did the activity is the currently logged in user'),
'filter' => array(
'handler' => 'views_handler_filter_user_current',
),
),
'uid_requested' => array(
'real field' => 'uid',
'title' => t('Currently requested user (url argument) carried out the activity'),
'help' => t('The user who did the activity is third argument in url heartbeat/user/% '),
'argument' => array(
'handler' => 'views_handler_argument_user_uid',
),
),
'uid_target' => array(
'title' => t('Target User'),
'help' => t('The user who was the target of the activity (if present)'),
'relationship' => array(
'base' => 'users',
'field' => 'uid',
'handler' => 'views_handler_relationship',
'label' => t('User'),
),
),
'message_id' => array(
'title' => t('Heartbeat message id'),
'help' => t('The id of the hearbeat message that was used.'),
'relationship' => array(
'base' => 'heartbeat_messages',
'field' => 'message_id',
'handler' => 'views_handler_relationship',
'label' => t('Heartbeat message'),
),
'field' => array(
'handler' => 'views_handler_field',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
),
'message' => array(
'title' => t('Message'),
'help' => t('Logged Message'),
'field' => array(
'handler' => 'views_handler_field_markup',
'format' => FILTER_FORMAT_DEFAULT,
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
),
// Language field
'language' => array(
'title' => t('Display language is current language(usertime)'),
'help' => t('The language the content is in.'),
'field' => array(
'handler' => 'views_handler_field',
),
'filter' => array(
'handler' => 'views_handler_filter_heartbeat_language',
),
),
'timestamp' => array(
'title' => t('Action\'s timestamp'),
'help' => t('When the action happened'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
),
'access_type' => array(
'real field' => 'uid',
'title' => t('access type messages'),
'help' => t('Restict with access types'),
'filter' => array(
'handler' => 'views_handler_filter_heartbeat_access',
),
),
),
//heartbeat messages
'heartbeat_messages' => array(
// Table to join
'table' => array(
'group' => t('Heartbeat messages table'),
),
'message_id' => array(
'title' => t('Heartbeat message id'),
'help' => t('ID of the hearbeat message'),
'field' => array(
'handler' => 'views_handler_field_markup',
),
),
'message' => array(
'title' => t('Heartbeat message'),
'help' => t('Hearbeat message'),
'field' => array(
'handler' => 'views_handler_field_markup',
),
),
'hid' => array(
'title' => t('Numeric heartbeat message id'),
'help' => t('Numeric heartbeat message id'),
'field' => array(
'handler' => 'views_handler_field_numeric',
),
),
'perms' => array(
'title' => t('Permissions'),
'help' => t('Permissions of the message'),
'filter' => array(
'handler' => 'views_handler_filter_heartbeat_perms',
),
),
'module' => array(
'title' => t('Module'),
'help' => t('Module to which to message is related'),
'filter' => array(
'handler' => 'views_handler_filter_heartbeat_module',
),
),
),
);
return $data;
}