TripalTermViewsController.inc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. *
  4. */
  5. class TripalTermViewsController extends EntityDefaultViewsController {
  6. /**
  7. * Edit or add extra fields to views_data().
  8. */
  9. public function views_data() {
  10. $data = parent::views_data();
  11. $data['tripal_term']['table']['group'] = 'Tripal Term';
  12. $data['tripal_term']['accession']['title'] = 'Term Accession';
  13. $data['tripal_term']['accession']['help'] = t('The unique term ID (accession) of the vocabulary term to which a Tripal content type is asscoiated.');
  14. $data['tripal_term']['name']['title'] = 'Term Name';
  15. $data['tripal_term']['name']['help'] = t('The term that a content type is associated with.');
  16. $data['tripal_term']['name']['filter']['handler'] = 'tripal_views_handler_filter_string_selectbox';
  17. $data['tripal_term']['vocab_id']['title'] = t('Vocabulary ID');
  18. $data['tripal_term']['vocab_id']['help'] = t('The internal numeric ID for the vocabulary to which the content type term belongs.');
  19. $data['tripal_term']['vocab_id']['relationship'] = array(
  20. 'base' => 'tripal_vocab',
  21. 'base field' => 'id',
  22. 'handler' => 'views_handler_relationship',
  23. 'label' => t('Tripal Content Vocabulary'),
  24. 'title' => t('Tripal Content Vocabulary'),
  25. 'help' => t('Associates the vocabulary ID of the Tripal content type with information about the vocabulary.')
  26. );
  27. $data['tripal_term']['table']['join'] = array();
  28. // Join the term to it's entity type.
  29. $data['tripal_term']['table']['join']['tripal_entity'] = array(
  30. 'handler' => 'views_join',
  31. 'left_field' => 'term_id',
  32. 'field' => 'id',
  33. );
  34. // It is not intended that the following fields will every be used by the
  35. // end-user.
  36. unset($data['tripal_term']['id']);
  37. unset($data['tripal_term']['changed']);
  38. unset($data['tripal_term']['created']);
  39. // This should not be a base table. It's not useful to create a
  40. // view of the tripal_term table.
  41. unset($data['tripal_term']['table']['base']);
  42. return $data;
  43. }
  44. }