views_handler_field_computed_stock_nid.inc 660 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * @file
  4. * Adds the Node ID to for the current stock
  5. *
  6. * This handler is only needed if chado is in a separate database and, therefore, the node tables
  7. * cannot be joined to the stock tables
  8. *
  9. * @ingroup tripal_stock
  10. * @ingroup views_field_handlers
  11. */
  12. class views_handler_field_computed_stock_nid extends views_handler_field_numeric {
  13. function construct() {
  14. parent::construct();
  15. $this->additional_fields['stock_id'] = array('table' => 'stock', 'field' => 'stock_id');
  16. }
  17. function query() {
  18. $this->ensure_my_table();
  19. $this->add_additional_fields();
  20. }
  21. function render($values) {
  22. return $values->stock_nid;
  23. }
  24. }