public function uo__unit::load

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

Overrides TripalField::load

See also

TripalField::load()

File

tripal_chado/includes/TripalFields/uo__unit/uo__unit.inc, line 40

Class

uo__unit

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' => '',
  );

  if ($record) {
    $entity->{$field_name}['und'][0]['value'] = $record->unittype_id->name;
    $entity->{$field_name}['und'][0]['chado-' . $field_table . '__unittype_id'] = $record->unittype_id->cvterm_id;
    $entity->{$field_name}['und'][0]['chado-cvterm__name'] = $record->unittype_id->name;
    $entity->{$field_name}['und'][0]['chado-cvterm__definition'] = $record->unittype_id->definition;
    $entity->{$field_name}['und'][0]['chado-cvterm__cv_id'] = $record->unittype_id->cv_id->cv_id;
    $entity->{$field_name}['und'][0]['chado-cv__name'] = $record->unittype_id->cv_id->name;
  }
}