You are here

function poll_views_data in Views (for Drupal 7) 8.3

Same name and namespace in other branches
  1. 6.3 modules/poll.views.inc \poll_views_data()
  2. 6.2 modules/poll.views.inc \poll_views_data()
  3. 7.3 modules/poll.views.inc \poll_views_data()

Implements hook_views_data().

File

modules/poll.views.inc, line 13
Provide views data and handlers for poll.module.

Code

function poll_views_data() {

  // Basic table information.
  $data['poll']['table']['group'] = t('Poll');

  // Join to 'node' as a base table.
  $data['poll']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );

  // Fields
  // poll active status
  $data['poll']['active'] = array(
    'title' => t('Active'),
    'help' => t('Whether the poll is open for voting.'),
    'field' => array(
      'id' => 'boolean',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'id' => 'boolean',
      'label' => t('Active'),
      'type' => 'yes-no',
    ),
    'sort' => array(
      'id' => 'standard',
    ),
  );
  return $data;
}