You are here

function simplenews_views_data in Simplenews 6

Same name and namespace in other branches
  1. 8.2 simplenews.views.inc \simplenews_views_data()
  2. 8 simplenews.views.inc \simplenews_views_data()
  3. 6.2 includes/views/simplenews.views.inc \simplenews_views_data()
  4. 7.2 includes/views/simplenews.views.inc \simplenews_views_data()
  5. 7 includes/views/simplenews.views.inc \simplenews_views_data()
  6. 3.x simplenews.views.inc \simplenews_views_data()

Implementation of hook_views_data().

File

./simplenews.views.inc, line 11
Views interface for simplenews.

Code

function simplenews_views_data() {

  // Basic table information.
  // Define the base group of this table. Fields that don't
  // have a group defined will go into this field by default.
  $data['simplenews_newsletters']['table']['group'] = t('Simplenews');
  $data['simplenews_newsletters']['table']['base'] = array(
    'field' => 'nid',
    'title' => t('Node'),
    'help' => t('Using nodes as newsletters.'),
  );

  // joins
  $data['simplenews_newsletters']['table']['join'] = array(
    //...to the node table
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );

  // ----------------------------------------------------------------
  // Fields
  // newsletter sent status
  $data['simplenews_newsletters']['s_status'] = array(
    'title' => t('Sent status'),
    // The item it appears as on the UI,
    'help' => t('Newsletter sent status: Not sent, Pending (being sent or waiting for cron to run), Sent.'),
    // The help that appears on the UI,
    'field' => array(
      'handler' => 'simplenews_handler_field_newsletter_s_status',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'simplenews_handler_filter_newsletter_s_status',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
  );
  return $data;
}