You are here

function newsletter_views_data in Newsletter 7.2

Same name and namespace in other branches
  1. 7 includes/views/newsletter.views.inc \newsletter_views_data()

Implements hook_views_data().

File

includes/views/newsletter.views.inc, line 11
Views interface for newsletter.

Code

function newsletter_views_data() {
  $data['newsletter_newsletter']['table'] = array(
    'base' => array(
      'field' => 'nnid',
      'title' => t('Newsletter'),
    ),
    'group' => t('Newsletter'),
    'entity_type' => 'newsletter_newsletter',
  );

  // nnid
  $data['newsletter_newsletter']['nnid'] = array(
    'title' => t('Nnid'),
    'help' => t('The newsletter ID.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // title
  $data['newsletter_newsletter']['title'] = array(
    'title' => t('Title'),
    'help' => t('The newsletter title.'),
    'field' => array(
      'handler' => 'views_handler_field',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_string',
    ),
  );

  // send_id
  $data['newsletter_newsletter']['send_id'] = array(
    'title' => t('Send ID'),
    'help' => t('The times a newsletter has been sent.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // custom
  $data['newsletter_newsletter']['custom'] = array(
    'title' => t('Custom'),
    'help' => t('Whether this newsletter sent as a custom one.'),
    'field' => array(
      'handler' => 'views_handler_field_boolean',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_boolean_operator',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // ntid
  $data['newsletter_newsletter']['ntid'] = array(
    'title' => t('Template ID'),
    'help' => t('The newsletter template ({newsletter_template}.ntid) this newsletter used.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
      'allow empty' => TRUE,
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'relationship' => array(
      'handler' => 'views_handler_relationship',
      'base' => 'newsletter_template',
      'base field' => 'ntid',
      'label' => t('Newsletter template'),
    ),
  );

  // subscribers_sent
  $data['newsletter_newsletter']['subscribers_sent'] = array(
    'title' => t('Subscribers sent'),
    'help' => t('The number of the subscribers a newsletter has been sent to.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // clicks
  $data['newsletter_newsletter']['clicks'] = array(
    'title' => t('Clicks'),
    'help' => t('The number of clicks a newsletter gathered.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // opens
  $data['newsletter_newsletter']['opens'] = array(
    'title' => t('Opens'),
    'help' => t('The number of opens a newsletter gathered.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );

  // last_sent
  $data['newsletter_newsletter']['last_sent'] = array(
    'title' => t('Last sent'),
    'help' => t('The newsletter last sent date.'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
    ),
  );
  return $data;
}