You are here

function notify_viewsintegration_views_data in Notify 7

Same name and namespace in other branches
  1. 6 notify_viewsintegration.module \notify_viewsintegration_views_data()

Implements hook_views_data().

File

submodules/notify_viewsintegration/notify_viewsintegration.module, line 36
Notify Views Integration provides integartion with the Views module.

Code

function notify_viewsintegration_views_data() {
  $data = array();
  $data['notify'] = array(
    // Table info.
    'table' => array(
      'group' => t('Notify'),
      'base' => array(
        'field' => 'uid',
        'title' => t('Notify'),
        'help' => t('This isn\'t really used. Create a view of \'Users\' and you\'ll see a new field and filter group called \'Notify.\'.'),
        'weight' => 0,
      ),
    ),
  );
  $data['notify']['uid'] = array(
    'title' => t('UID'),
    'help' => t('The ID of the user'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  $data['notify']['status'] = array(
    'title' => t('Master switch status'),
    'help' => t('Set to “1” for enabled,  “0” or blank for disabled.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
  );
  $data['notify']['node'] = array(
    'title' => t('New content'),
    'help' => t('Set to “1” for enabled,  “0” or blank for disabled.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
  );
  $data['notify']['comment'] = array(
    'title' => t('New comments'),
    'help' => t('Set to “1” for enabled,  “0” or blank for disabled.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
  );
  $data['notify']['attempts'] = array(
    'title' => t('Number of failed attempts'),
    'help' => t('Indicates whether there has been any failed sends for this user.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
  );
  $data['notify']['teasers'] = array(
    'title' => t('How much to notify about'),
    'help' => t('Set to: “0” for Title only,  “1” for Title + Teaser,  “2” for Title + Body,  “3” for Title + Body + Fields.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
  );
  $data['notify']['table']['join'] = array(
    'users' => array(
      'table' => 'notify',
      'left_field' => 'uid',
      'field' => 'uid',
      'left_table' => 'users',
    ),
  );
  return $data;
}