You are here

function role_expire_views_data in Role Expire 8

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

Implements hook_views_data().

Return value

array

File

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

Code

function role_expire_views_data() {
  $data = [];
  $data['role_expire'] = [];
  $data['role_expire']['table'] = [];
  $data['role_expire']['table']['group'] = t('Role expire');
  $data['role_expire']['table']['provider'] = 'role_expire';
  $data['role_expire']['table']['join'] = [
    'users_field_data' => [
      'left_field' => 'uid',
      'field' => 'uid',
    ],
  ];

  // Integer timestamp field, exposed as a field, sort, and filter.
  $data['role_expire']['expiry_timestamp'] = [
    'title' => t('Role expiration date/time'),
    'help' => t('Date and time the role will expire. (See also Role expiration role).'),
    'field' => [
      // ID of field handler plugin to use.
      'id' => 'role_expire_date',
    ],
    'sort' => [
      // ID of sort handler plugin to use.
      'id' => 'role_expire_date',
    ],
    'filter' => [
      // ID of filter handler plugin to use.
      'id' => 'role_expire_date',
    ],
  ];
  $data['role_expire']['rid'] = [
    'title' => t('Role expiration role'),
    'help' => t('The Role that corresponds with the Role expiration date/time'),
    'field' => [
      // ID of field handler plugin to use.
      'id' => 'role_expire_rid',
    ],
    'sort' => [
      // ID of sort handler plugin to use.
      'id' => 'role_expire_rid',
    ],
    'filter' => [
      // ID of filter handler plugin to use.
      'id' => 'string',
    ],
  ];
  return $data;
}