You are here

notify_viewsintegration.module in Notify 6

File

notify_viewsintegration.module
View source
<?php

function notify_viewsintegration_views_api() {
  return array(
    'api' => 2,
  );
}

// Implements hook_views_data()
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('Subscription Status'),
    'help' => t('Whether or not the user is subscribed. Set to \'1\' for subscribed or leave it blank for not subscribed. \'0\' will return someone who has subscribed and then changed their preference.'),
    '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('Subscription Status to Node'),
    'help' => t('Whether or not the user is subscribed to nodes. Set to \'1\' for subscribed or leave it blank for not subscribed. \'0\' will return someone who has subscribed and then changed their preference.'),
    '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('Subscription Status to Comments'),
    'help' => t('Whether or not the user is subscribed to comments. Set to \'1\' for subscribed or leave it blank for not subscribed. \'0\' will return someone who has subscribed and then changed their preference.'),
    '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;
}