You are here

function agreement_views_data in Agreement 3.0.x

Same name and namespace in other branches
  1. 8.2 agreement.views.inc \agreement_views_data()
  2. 6.2 agreement.module \agreement_views_data()
  3. 6 agreement.module \agreement_views_data()
  4. 7.2 agreement.views.inc \agreement_views_data()

Implements hook_views_data().

File

./agreement.views.inc, line 11
Agreement views info.

Code

function agreement_views_data() {
  $data = [];
  $data['agreement']['table']['group'] = t('User');
  $data['agreement']['table']['provider'] = 'agreement';
  $data['agreement']['table']['join'] = [
    'users_field_data' => [
      'left_field' => 'uid',
      'field' => 'uid',
      'type' => 'left',
    ],
  ];
  $data['agreement']['agreed_date'] = [
    'title' => t('Agreement date'),
    'help' => t('The date the agreement was submitted.'),
    'field' => [
      'id' => 'date',
      'click sortable' => TRUE,
    ],
    'filter' => [
      'id' => 'date',
    ],
    'sort' => [
      'id' => 'date',
    ],
  ];
  $data['agreement']['agreed'] = [
    'title' => t('Has agreed'),
    'help' => t('Agreement records shows user has agreed or not.'),
    'field' => [
      'id' => 'boolean',
    ],
    'sort' => [
      'id' => 'numeric',
    ],
    'filter' => [
      'id' => 'boolean',
      'label' => t('Has Agreed'),
      'type' => 'yes-no',
    ],
  ];
  $data['agreement']['type'] = [
    'title' => t('Agreement'),
    'help' => t('The agreement type associated with this agreement record.'),
    'field' => [
      'id' => 'agreement_entity',
    ],
    'filter' => [
      'id' => 'in_operator',
      'options callback' => 'agreement_get_agreement_options',
    ],
    'sort' => [
      'id' => 'string',
    ],
    'argument' => [
      'id' => 'string',
    ],
  ];
  return $data;
}