TripalEntityViewsController.inc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. *
  4. */
  5. class TripalEntityViewsController extends EntityDefaultViewsController {
  6. /**
  7. * Edit or add extra fields to views_data().
  8. */
  9. public function views_data() {
  10. $data = parent::views_data();
  11. // Change handlers for Date Timestamps.
  12. // Date Created.
  13. $data['tripal_entity']['created']['field']['handler'] = 'views_handler_field_date';
  14. $data['tripal_entity']['created']['sort']['handler'] = 'views_handler_sort_date';
  15. $data['tripal_entity']['created']['filter']['handler'] = 'views_handler_filter_date';
  16. $data['tripal_entity']['created']['help'] = t('The date that the content was created.');
  17. // Date Changed/Updated.
  18. $data['tripal_entity']['changed']['field']['handler'] = 'views_handler_field_date';
  19. $data['tripal_entity']['changed']['sort']['handler'] = 'views_handler_sort_date';
  20. $data['tripal_entity']['changed']['filter']['handler'] = 'views_handler_filter_date';
  21. $data['tripal_entity']['changed']['help'] = t('The date that the content was last updated.');
  22. $data['tripal_entity']['id']['title'] = 'Tripal Content ID';
  23. $data['tripal_entity']['id']['help'] = 'The unique numeric ID for the content';
  24. $data['tripal_entity']['title']['help'] = 'The content\'s title.';
  25. $data['tripal_entity']['title']['field']['handler'] = 'tripal_views_handler_field_entity';
  26. $data['tripal_entity']['uid']['help'] = 'The User\'s unique ID.';
  27. $data['tripal_entity']['status']['help'] = 'The publish status.';
  28. $data['tripal_entity']['status']['field']['handler'] = 'tripal_views_handler_field_entity_status';
  29. $data['tripal_entity']['uid']['relationship'] = array(
  30. 'base' => 'users',
  31. 'base field' => 'uid',
  32. 'handler' => 'views_handler_relationship',
  33. 'label' => t('Users'),
  34. 'title' => t('Users'),
  35. 'help' => t('Associates the user information with this record.')
  36. );
  37. // It is not intended that the following fields will every be used by the
  38. // end-user within Views.
  39. unset($data['tripal_entity']['bundle']);
  40. unset($data['tripal_entity']['term_id']);
  41. unset($data['tripal_entity']['type']);
  42. return $data;
  43. }
  44. }