public function sio__vocabulary::load

3.x sio__vocabulary.inc public sio__vocabulary::load($entity)

Overrides TripalField::load

See also

TripalField::load()

File

tripal_chado/includes/TripalFields/sio__vocabulary/sio__vocabulary.inc, line 75

Class

sio__vocabulary

Code

public function 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'];

  // Set some defaults for the empty record.
  $entity->{$field_name}['und'][0] = array(
    'value' => array(),
  );

  if ($record) {
    $cv = $record->cv_id;
    $entity->{$field_name}['und'][0]['value'] = $cv->name;
    $entity->{$field_name}['und'][0]['chado-' . $field_table . '__cv_id'] = $cv->cv_id;
  }
}