You are here

function record_shorten_views_data in Shorten URLs 7.2

Same name and namespace in other branches
  1. 8.2 modules/record_shorten/record_shorten.views.inc \record_shorten_views_data()
  2. 8 modules/record_shorten/record_shorten.views.inc \record_shorten_views_data()
  3. 6 record_shorten.views.inc \record_shorten_views_data()
  4. 7 record_shorten.views.inc \record_shorten_views_data()

Implements hook_views_data().

File

./record_shorten.views.inc, line 11
Provide views data and handlers for the Record Shortened URLs module.

Code

function record_shorten_views_data() {

  // Basic table information.
  $data['record_shorten']['table']['group'] = t('Shortened URLs');

  // Advertise this table as a possible base table.
  $data['record_shorten']['table']['base'] = array(
    'field' => 'sid',
    'title' => t('Shortened URLs'),
    'help' => t('Listings of URLs shortened by the Shorten URLs module.'),
    'weight' => 10,
  );
  $data['users']['table']['join'] = array(
    'record_shorten' => array(
      'left_field' => 'uid',
      'field' => 'uid',
      'type' => 'LEFT',
    ),
  );
  $data['record_shorten']['sid'] = array(
    'title' => t('Shorten ID'),
    'help' => t('The ID of the recorded URL.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
  );
  $data['record_shorten']['original'] = array(
    'title' => t('Original URL'),
    'help' => t('The original, long, unshortened URL.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );
  $data['record_shorten']['short'] = array(
    'title' => t('Shortened URL'),
    'help' => t('The new, computed, shortened URL.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );
  $data['record_shorten']['service'] = array(
    'title' => t('Service'),
    'help' => t('The service used to shorten the URL.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'record_shorten_views_handler_filter_string_service',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_string',
    ),
  );
  $data['record_shorten']['uid'] = array(
    'title' => t('User ID'),
    'help' => t('The User ID of the user who created the shortened URL.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
  );
  $data['record_shorten']['hostname'] = array(
    'title' => t('IP Address'),
    'help' => t('The IP address of the user who created the shortened URL.'),
    'field' => array(
      'handler' => 'record_shorten_views_handler_field_hostname',
      'click sortable' => FALSE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
  );
  $data['record_shorten']['created'] = array(
    'title' => t('Created time'),
    'help' => t('The time the shortened URL was created.'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
  );
  return $data;
}