misc_tables.views.inc 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * @file
  4. * Purpose: Allows the library module to add fields to other module views
  5. *
  6. * For example, a field counting the number of libraries associted with a given feature would be
  7. * added to the feature view as follows:
  8. * @code
  9. $data['feature']['num_libraries'] = array(
  10. 'title' => "Number of Libraries",
  11. 'help' => "Provides a count of the number of libraries associated with a given feature",
  12. 'field' => array(
  13. 'handler' => 'views_handler_field_chado_count',
  14. 'table_to_query' => 'library_feature',
  15. ),
  16. );
  17. * @endcode
  18. *
  19. * @ingroup tripal_library_views
  20. */
  21. function retrieve_library_misc_tables_views_data() {
  22. $data = array();
  23. // Table: Feature---------------------------------------------------------------------------------
  24. // Calculated Field: Number of Libraries (Count -Int)
  25. // Provides the number of libraries for a given feature
  26. $data['feature']['num_libraries'] = array(
  27. 'title' => "Number of Libraries",
  28. 'help' => "Provides a count of the number of libraries associated with a given feature",
  29. 'field' => array(
  30. 'handler' => 'views_handler_field_chado_count',
  31. 'table_to_query' => 'library_feature',
  32. ),
  33. );
  34. // Table: Organism--------------------------------------------------------------------------------
  35. // Calculated Field: Number of Libraries (Count -Int)
  36. // Provides the number of libraries for a given organism
  37. $data['organism']['num_libraries'] = array(
  38. 'title' => 'Number of Libraries',
  39. 'help' => 'Provides a count of the number of libraries associated with a given organism',
  40. 'field' => array(
  41. 'handler' => 'views_handler_field_chado_count',
  42. 'table_to_query' => 'library',
  43. ),
  44. );
  45. return $data;
  46. }