uc_coupon_purchase.views.inc 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * @file
  4. * Views 2 hooks and callback registries.
  5. */
  6. /**
  7. * Implements hook_views_data().
  8. */
  9. function uc_coupon_purchase_views_data() {
  10. $data['uc_coupon_purchase_users']['table']['join']['users'] = array(
  11. 'left_field' => 'uid',
  12. 'field' => 'uid',
  13. );
  14. $data['uc_coupon_purchase_users']['table']['join']['uc_coupons'] = array(
  15. 'left_field' => 'cid',
  16. 'field' => 'cid',
  17. );
  18. return $data;
  19. }
  20. /**
  21. * Implements hook_views_data_alter().
  22. */
  23. function uc_coupon_purchase_views_data_alter(&$data) {
  24. $data['uc_coupons']['table']['join']['users'] = array(
  25. 'left_table' => 'uc_coupon_purchase_users',
  26. 'left_field' => 'cid',
  27. 'field' => 'cid',
  28. );
  29. $data['users']['table']['join']['uc_coupons'] = array(
  30. 'left_table' => 'uc_coupon_purchase_users',
  31. 'left_field' => 'uid',
  32. 'field' => 'uid',
  33. );
  34. $data['uc_coupons']['base_name'] = array(
  35. 'title' => t('Purchase base name'),
  36. 'help' => t('The name of the coupon this purchased coupon is based on.'),
  37. 'field' => array(
  38. 'field' => 'name',
  39. 'handler' => 'uc_coupon_purchase_handler_field_base_name',
  40. 'click sortable' => TRUE,
  41. ),
  42. 'sort' => array(
  43. 'field' => 'name',
  44. 'handler' => 'views_handler_sort',
  45. ),
  46. 'filter' => array(
  47. 'field' => 'name',
  48. 'handler' => 'views_handler_filter_string',
  49. ),
  50. 'argument' => array(
  51. 'field' => 'name',
  52. 'handler' => 'views_handler_argument_string',
  53. ),
  54. );
  55. }
  56. /**
  57. * Implements hook_views_handlers().
  58. */
  59. function uc_coupon_purchase_views_handlers() {
  60. return array(
  61. 'info' => array(
  62. 'path' => drupal_get_path('module', 'uc_coupon_purchase') . '/views',
  63. ),
  64. 'handlers' => array(
  65. 'uc_coupon_purchase_handler_field_base_name' => array(
  66. 'parent' => 'views_handler_field',
  67. ),
  68. ),
  69. );
  70. }