You are here

function activity_views_data in Activity 6

Same name and namespace in other branches
  1. 8 activity.views.inc \activity_views_data()
  2. 6.2 views/activity.views.inc \activity_views_data()
  3. 7 views/activity.views.inc \activity_views_data()

Implementation of hook_views_data().

File

./activity.views.inc, line 6

Code

function activity_views_data() {
  $data = array();
  $data['activity']['table']['group'] = t('Activity');
  $data['activity']['table']['base'] = array(
    'field' => 'aid',
    'title' => t('Activity'),
    'help' => t('Activity table stuff help'),
  );
  $data['activity']['aid'] = array(
    'title' => t('Activity id'),
    'help' => t('The id of the activity item'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
  );
  $data['activity']['uid'] = array(
    'title' => t('User id'),
    'help' => t('The user id of the user who triggered the activity.'),
    'filter' => array(
      'handler' => 'views_handler_filter_user_current',
    ),
    'relationship' => array(
      'handler' => 'views_handler_relationship',
      'base' => 'users',
      'relationship field' => 'uid',
      'label' => t('Activity: Users'),
    ),
  );
  $data['activity']['module'] = array(
    'title' => t('Module'),
    'help' => t('The module that triggered the activity'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'activity_views_handler_filter_module',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['activity']['type'] = array(
    'title' => t('Type'),
    'help' => t('The type of activity'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'activity_views_handler_filter_type',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['activity']['operation'] = array(
    'title' => t('Operation'),
    'help' => t('The operation done'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'activity_views_handler_filter_operation',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['activity']['created'] = array(
    'title' => t('Created'),
    'help' => t('The date of the activity'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
  );
  $data['activity']['data'] = array(
    'title' => t('Data'),
    'help' => t('The serialized data of the activity, user id, node id, etc...'),
    'field' => array(
      'handler' => 'activity_views_handler_field_serial',
      'click sortable' => FALSE,
    ),
  );
  $data['activity_targets']['table']['group'] = t('Activity');
  $data['activity_targets']['table']['join'] = array(
    'activity' => array(
      'left_field' => 'aid',
      'field' => 'aid',
    ),
  );
  $data['activity_targets']['target_uid'] = array(
    'title' => t('Target User'),
    'help' => t('The user id to target'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'relationship' => array(
      'handler' => 'views_handler_relationship',
      'base' => 'users',
      'relationship field' => 'uid',
      'label' => t('Activity Target: Users'),
    ),
  );
  $data['activity_targets']['target_role'] = array(
    'title' => t('Target Role'),
    'help' => t('The target role'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'activity_views_handler_filter_role',
    ),
    'sort' => array(
      'handler' => 'activity_views_sort',
    ),
  );
  return $data;
}