local__child_annotations.inc 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * @class
  4. * Purpose:
  5. *
  6. * Data:
  7. * Assumptions:
  8. */
  9. class local__child_annotations extends ChadoField {
  10. public static $default_label = 'Child Annotations';
  11. public static $default_description = 'All of the annotations associated with child features.';
  12. public static $default_widget = 'local__child_annotations_widget';
  13. public static $default_formatter = 'local__child_annotations_formatter';
  14. public static $module = 'tripal_chado';
  15. public static $default_settings = [
  16. 'storage' => 'field_chado_storage',
  17. 'searchable_keys' => [],
  18. ];
  19. public static $download_formatters = [
  20. 'TripalTabDownloader',
  21. 'TripalCSVDownloader',
  22. ];
  23. public static $default_instance_settings = [
  24. // The DATABASE name, as it appears in chado.db. This also builds the link-out url. In most cases this will simply be the CV name. In some cases (EDAM) this will be the SUBONTOLOGY.
  25. 'term_vocabulary' => 'local',
  26. // The name of the term.
  27. 'term_name' => 'child_properties',
  28. // The unique ID (i.e. accession) of the term.
  29. 'term_accession' => 'child_properties',
  30. // Set to TRUE if the site admin is not allowed to change the term
  31. // type, otherwise the admin can change the term mapped to a field.
  32. 'term_fixed' => FALSE,
  33. // Indicates if this field should be automatically attached to display
  34. // or web services or if this field should be loaded separately. This
  35. // is convenient for speed. Fields that are slow should for loading
  36. // should have auto_attach set to FALSE so tha their values can be
  37. // attached asynchronously.
  38. 'auto_attach' => FALSE,
  39. // The table in Chado that the instance maps to.
  40. 'chado_table' => '',
  41. // The column of the table in Chado where the value of the field comes from.
  42. 'chado_column' => '',
  43. // The base table.
  44. 'base_table' => '',
  45. ];
  46. public static $no_ui = FALSE;
  47. public static $no_data = FALSE;
  48. /**
  49. * @see ChadoField::load()
  50. **/
  51. public function load($entity) {
  52. parent::load($entity);
  53. $master = $entity->data__sequence_features['und'];
  54. $properties = [];
  55. // foreach ($master as $child){
  56. //
  57. // //remove all the other fields from the expand_var.
  58. //
  59. // }
  60. //TODO: filter this to just hte annotations.
  61. $entity->local__child_properties['und'] = $master;
  62. }
  63. /**
  64. * @see ChadoField::query()
  65. **/
  66. public function query($query, $condition) {
  67. }
  68. /**
  69. * @see ChadoField::queryOrder()
  70. **/
  71. public function queryOrder($query, $order) {
  72. }
  73. /**
  74. * @see ChadoField::elementInfo()
  75. **/
  76. public function elementInfo() {
  77. $field_term = $this->getFieldTermID();
  78. return [
  79. $field_term => [
  80. 'operations' => ['eq', 'ne', 'contains', 'starts'],
  81. 'sortable' => TRUE,
  82. 'searchable' => TRUE,
  83. ],
  84. ];
  85. }
  86. }