poll.views.inc

  1. 3.x modules/poll.views.inc
  2. 2.x modules/poll.views.inc

Provide views data and handlers for poll.module

File

modules/poll.views.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Provide views data and handlers for poll.module
  5. */
  6. /**
  7. * @defgroup views_poll_module poll.module handlers
  8. *
  9. * Includes only the core 'poll' table for now.
  10. * @{
  11. */
  12. /**
  13. * Implementation of hook_views_data()
  14. */
  15. function poll_views_data() {
  16. // Basic table information.
  17. $data['poll']['table']['group'] = t('Poll');
  18. // Join to 'node' as a base table.
  19. $data['poll']['table']['join'] = array(
  20. 'node' => array(
  21. 'left_field' => 'nid',
  22. 'field' => 'nid',
  23. ),
  24. );
  25. // ----------------------------------------------------------------
  26. // Fields
  27. // poll active status
  28. $data['poll']['active'] = array(
  29. 'title' => t('Active'),
  30. 'help' => t('Whether the poll is open for voting.'),
  31. 'field' => array(
  32. 'handler' => 'views_handler_field_boolean',
  33. 'click sortable' => TRUE,
  34. ),
  35. 'filter' => array(
  36. 'handler' => 'views_handler_filter_boolean_operator',
  37. 'label' => t('Active'),
  38. 'type' => 'yes-no',
  39. ),
  40. 'sort' => array(
  41. 'handler' => 'views_handler_sort',
  42. ),
  43. );
  44. return $data;
  45. }
  46. /**
  47. * @}
  48. */