local__child_properties.inc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * @class
  4. * Purpose:
  5. *
  6. * Data:
  7. * Assumptions:
  8. */
  9. class local__child_properties extends ChadoField {
  10. public static $default_label = 'Child Properties';
  11. public static $default_description = 'All of the properties 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. // $child['info'] = $child['info']->featureprops;
  60. //
  61. // }
  62. //TODO: filter this to just hte properties.
  63. // Right now we include everything because we are having this field do double duty for annotations.
  64. $entity->local__child_properties['und'] = $master;
  65. }
  66. /**
  67. * @see ChadoField::query()
  68. **/
  69. public function query($query, $condition) {
  70. }
  71. /**
  72. * @see ChadoField::queryOrder()
  73. **/
  74. public function queryOrder($query, $order) {
  75. }
  76. /**
  77. * @see ChadoField::elementInfo()
  78. **/
  79. public function elementInfo() {
  80. $field_term = $this->getFieldTermID();
  81. return [
  82. $field_term => [
  83. 'operations' => ['eq', 'ne', 'contains', 'starts'],
  84. 'sortable' => TRUE,
  85. 'searchable' => TRUE,
  86. ],
  87. ];
  88. }
  89. }