misc_tables.views.inc 1.7 KB

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