tripal_contact.views.inc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * @file
  4. * This file contains the basic functions for views integration of
  5. * chado/tripal_contact tables. Supplementary functions can be found in
  6. * ./views/
  7. *
  8. * Documentation on views integration can be found at
  9. * http://views2.logrus.com/doc/html/index.html.
  10. */
  11. /*************************************************************************
  12. * Implements hook_views_data()
  13. * Purpose: Describe chado/tripal tables & fields to views
  14. *
  15. * @return: a data array which follows the structure outlined in the
  16. * views2 documentation for this hook. Essentially, it's an array of table
  17. * definitions keyed by chado/tripal table name. Each table definition
  18. * includes basic details about the table, fields in that table and
  19. * relationships between that table and others (joins)
  20. *
  21. * @ingroup tripal_contact
  22. */
  23. function tripal_contact_views_data() {
  24. $data = array();
  25. if (module_exists('tripal_views')) {
  26. // Base Table: contact
  27. $table_name = 'contact';
  28. if (!tripal_views_is_integrated($tablename, 10)) {
  29. $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, TRUE);
  30. tripal_views_integration_add_entry($table_integration_array);
  31. }
  32. // Additional tables
  33. $tables = array(
  34. 'contact_relationship',
  35. );
  36. foreach ($tables as $tablename) {
  37. if (!tripal_views_is_integrated($tablename, 10)) {
  38. $table_integration_array = tripal_views_get_integration_array_for_chado_table($tablename, FALSE);
  39. tripal_views_integration_add_entry($table_integration_array);
  40. }
  41. }
  42. }
  43. return $data;
  44. }
  45. /*************************************************************************
  46. * Implements hook_views_handlers()
  47. * Purpose: Register all custom handlers with views
  48. * where a handler describes either "the type of field",
  49. * "how a field should be filtered", "how a field should be sorted"
  50. *
  51. * @return: An array of handler definitions
  52. *
  53. * @ingroup tripal_contact
  54. */
  55. function tripal_contact_views_handlers() {
  56. return array(
  57. 'info' => array(
  58. 'path' => drupal_get_path('module', 'tripal_contact') . '/views/handlers',
  59. ),
  60. 'handlers' => array(
  61. ),
  62. );
  63. }