123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?php
- class sep__protocol extends ChadoField {
-
- public static $default_label = 'Protocol';
-
- public static $default_description = 'The protocol followed to generate this resource.';
-
- public static $default_widget = 'sep__protocol_widget';
-
- public static $default_formatter = 'sep__protocol_formatter';
-
- public static $module = 'tripal_chado';
-
-
-
-
-
- public static $default_settings = [
- 'storage' => 'field_chado_storage',
-
-
-
-
-
-
- 'searchable_keys' => [],
- ];
-
-
-
-
-
-
-
- public static $default_instance_settings = [
-
- 'term_vocabulary' => 'sep',
-
- 'term_name' => 'protocol',
-
- 'term_accession' => '00101',
-
-
- 'term_fixed' => FALSE,
-
-
-
-
-
- 'auto_attach' => FALSE,
- ];
-
-
-
-
- public static $no_ui = FALSE;
-
-
-
-
- public static $no_data = FALSE;
-
- public function load($entity) {
- parent::load($entity);
- $record = $entity->chado_record;
- $settings = $this->instance['settings'];
- $field_name = $this->field['field_name'];
- $field_type = $this->field['type'];
- $field_table = $this->instance['settings']['chado_table'];
- $field_column = $this->instance['settings']['chado_column'];
- $linker_field = 'chado-' . $field_table . '__protocol_id';
-
- $entity->{$field_name}['und'][0] = [
- 'value' => [],
- ];
- if (!$record->protocol_id->protocol_id) {
- return;
- }
- $protocol_id = $record->protocol_id->protocol_id;
- $protocol_name = $record->protocol_id->name;
- $entity_id = $record->entity_id;
- $entity->{$field_name}['und'][0]['value'] = [
- "protocol_id" => $protocol_id,
- "protocol_name" => $protocol_name,
- "entity_id" => $entity_id,
- ];
-
- if (property_exists($record->{$field_column}, 'entity_id')) {
- $entity->{$field_name}['und'][0]['value']['entity_id'] = 'TripalEntity:' . $record->{$field_column}->entity_id;
- }
- }
- }
|