misc_tables.views.inc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Purpose: Allows the stock module to add fields to other module views
  4. *
  5. * For example, a field counting the number of stocks associted with a given organism would be
  6. * added to the organism view as follows:
  7. * @code
  8. $data['organism']['num_stocks'] = array(
  9. 'title' => 'Number of stocks',
  10. 'help' => 'Provides a count of the number of stocks associated with a given organism',
  11. 'field' => array(
  12. 'handler' => 'views_handler_field_chado_count',
  13. 'table_to_query' => 'stock',
  14. ),
  15. );
  16. * @endcode
  17. */
  18. function retrieve_stock_misc_tables_views_data() {
  19. $data = array();
  20. // Table: Organism--------------------------------------------------------------------------------
  21. // Calculated Field: Number of stocks (Count -Int)
  22. // Provides the number of stocks for a given organism
  23. $data['organism']['num_stocks'] = array(
  24. 'title' => 'Number of Stocks',
  25. 'help' => 'Provides a count of the number of stocks associated with a given organism',
  26. 'field' => array(
  27. 'handler' => 'views_handler_field_chado_count',
  28. 'table_to_query' => 'stock',
  29. ),
  30. );
  31. return $data;
  32. }