You are here

function role_expire_views_data in Role Expire 7

Same name and namespace in other branches
  1. 8 role_expire.views.inc \role_expire_views_data()
  2. 6 role_expire.views.inc \role_expire_views_data()
  3. 2.x role_expire.views.inc \role_expire_views_data()

Implementation of hook_views_data().

The purpose of this hook is to tell Views what data we make available.

File

./role_expire.views.inc, line 29
Role Expire Views hooks

Code

function role_expire_views_data() {
  $data['role_expire']['table']['group'] = t('User');
  $data['role_expire']['table']['join'] = array(
    'users' => array(
      'left_field' => 'uid',
      'field' => 'uid',
    ),
  );

  // Expose all role expire information.
  $data['role_expire']['all'] = array(
    'title' => t('Role expiration all data'),
    'help' => t('Shows roles that expire with their expiration date'),
    // Information for displaying the rid
    'field' => array(
      'handler' => 'role_expire_handler_field_all',
      'click sortable' => TRUE,
    ),
  );

  // Expose the role expiration date
  $data['role_expire']['expiry_timestamp'] = array(
    'title' => t('Role expiration date/time'),
    'help' => t('Date and time the role will expire. (See also Role expiration role.)'),
    'field' => array(
      'handler' => 'role_expire_handler_field_expiry_timestamp',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
  );

  // Expose the role id from role_expire
  $data['role_expire']['rid'] = array(
    'title' => t('Role expiration role'),
    'help' => t('The Role that corresponds with the Role expiration date/time'),
    // Information for displaying the rid
    'field' => array(
      'handler' => 'role_expire_handler_field_rid',
      'click sortable' => TRUE,
    ),
    // Information for accepting a rid as an argument
    'argument' => array(
      'handler' => 'views_handler_argument_users_roles_rid',
      'name field' => 'title',
      // the field to display in the summary.
      'numeric' => TRUE,
      'validate type' => 'rid',
    ),
    // Information for accepting a uid as a filter
    'filter' => array(
      'handler' => 'views_handler_filter_user_roles',
    ),
    // Information for sorting on a uid.
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  return $data;
}