views_handler_field_computed_stock_nid.inc 640 B

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