function heartbeat_views_data in Heartbeat 7
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()
- 6.3 views/heartbeat_views.views.inc \heartbeat_views_data()
Implements hook_views_data().
File
- ./
heartbeat.views.inc, line 10 - Heartbeat Views support. Declares the required tables for Views.
Code
function heartbeat_views_data() {
$tables['heartbeat_activity'] = array(
'table' => array(
'group' => t('Heartbeat activity'),
'join' => array(
'users' => array(
'table' => 'heartbeat_activity',
'left_field' => 'uid',
'field' => 'uid',
),
'node' => array(
'table' => 'heartbeat_activity',
'left_field' => 'nid',
'field' => 'nid',
),
),
'base' => array(
'field' => 'uaid',
'title' => t('Heartbeat activity'),
'help' => t('Heartbeat activity content to form a news feed or heartbeat stream.'),
'weight' => 0,
),
),
'message' => array(
'title' => t('Activity message'),
'help' => t('The singular activity message'),
'real field' => 'variables',
'field' => array(
'handler' => 'views_handler_field_heartbeat_message',
'click sortable' => TRUE,
),
),
'uaid' => array(
'title' => t('User activity ID'),
'help' => t('The user activity ID'),
//'real field' => 'uaid',
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'uid' => array(
'title' => t('User ID'),
'help' => t('The user ID'),
//'real field' => 'uid',
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'relationship' => array(
'base' => 'users',
'field' => 'uid',
'label' => 'User ID',
'help' => t('Bring in data about the user in the activity.'),
),
),
'uid_target' => array(
'title' => t('User target ID'),
'help' => t('User target ID, addressee in the activity message'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'relationship' => array(
'base' => 'users',
'field' => 'uid',
'label' => 'User target ID',
'help' => t('Bring in data about the user being addressed.'),
),
),
'nid' => array(
'title' => t('Node ID'),
'help' => t('Node ID used in the activity message'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_node_nid',
'name field' => 'title',
// the field to display in the summary.
'numeric' => TRUE,
'validate type' => 'nid',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'relationship' => array(
'base' => 'node',
'field' => 'nid',
'label' => 'content',
'help' => t('Bring in data about the main node.'),
),
),
'nid_target' => array(
'title' => t('Node target ID'),
'help' => t('Node target ID used in the activity message'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_node_nid',
'name field' => 'title',
// the field to display in the summary.
'numeric' => TRUE,
'validate type' => 'nid',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'relationship' => array(
// this relationship brings in all fields the node table offers
'base' => 'node',
'field' => 'nid',
'label' => 'content',
'help' => t('Bring in data about the node being addressed.'),
),
),
'created_at' => array(
'title' => t('Creation date'),
'real field' => 'timestamp',
'help' => t('Date the activity was registered'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
),
'message_id' => array(
'title' => t('Heartbeat template'),
'real field' => 'message_id',
'help' => t('The message template'),
'field' => array(
'handler' => 'views_handler_field_heartbeat_message_id',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_string',
),
'filter' => array(
'handler' => 'views_handler_filter_heartbeat_message_id',
),
),
'stream' => array(
'title' => t('Activity Stream'),
'real field' => 'uid',
'help' => t('Heartbeat Activity Stream to alter the query'),
'filter' => array(
'handler' => 'views_handler_filter_heartbeat_stream',
),
),
'attachments' => array(
'title' => t('Attachments'),
'help' => t('Attachments for the activity message'),
'real field' => 'uaid',
'field' => array(
'handler' => 'views_handler_field_heartbeat_attachments',
'click sortable' => TRUE,
),
),
'buttons' => array(
'title' => t('Buttons'),
'help' => t('Buttons associated with activity messages'),
'real field' => 'uaid',
'field' => array(
'handler' => 'views_handler_field_heartbeat_buttons',
'click sortable' => TRUE,
),
),
);
return $tables;
}