function tripal_chado_bundle_fields_info_custom

3.x tripal_chado.fields.inc tripal_chado_bundle_fields_info_custom(&$info, $details, $entity_type, $bundle)

Parameters

unknown $details:

1 call to tripal_chado_bundle_fields_info_custom()

File

tripal_chado/includes/tripal_chado.fields.inc, line 217

Code

function tripal_chado_bundle_fields_info_custom(&$info, $details, $entity_type, $bundle) {
  $table_name = $details['chado_table'];
  $type_table = $details['chado_type_table'];
  $type_column = $details['chado_type_column'];
  $cvterm_id = $details['chado_cvterm_id'];
  $type_value = $details['chado_type_value'];

  $schema = chado_get_schema($table_name);

  // Handle type_id fields that are not the type_column.
  if (array_key_exists('type_id', $schema['fields']) and 'type_id' != $type_column) {
    $field_name = 'schema__additional_type';
    $field_type = 'schema__additional_type';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // BASE ORGANISM_ID
  if ($table_name != 'organism' and 
    (array_key_exists('organism_id', $schema['fields']) or
      array_key_exists('taxon_id', $schema['fields']))) {
    $field_name = 'obi__organism';
    $field_type = 'obi__organism';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  if ($table_name == 'biomaterial') {
    $field_name = 'biomaterial__provider_id';
    $field_type = 'local__contact';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // BASE ORGANISM_ID
  if ($table_name == 'cvterm') {
    $field_name = 'sio__vocabulary';
    $field_type = 'sio__vocabulary';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // BASE DBXREF
  if (array_key_exists('dbxref_id', $schema['fields'])) {
    $field_name = 'data__accession';
    $field_type = 'data__accession';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // FEATURE MD5CHECKSUM
  if ($table_name == 'feature') {
    $field_name = 'data__sequence_checksum';
    $field_type = 'data__sequence_checksum';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // FEATURE RESIDUES
  if ($table_name == 'feature') {
    $field_name = 'data__sequence';
    $field_type = 'data__sequence';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // FEATURE SEQLEN
  if ($table_name == 'feature') {
    $field_name = 'data__sequence_length';
    $field_type = 'data__sequence_length';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // PROTEIN & CDS
  if ($table_name == 'feature' and 
    ($bundle->label == 'mRNA' or $bundle->label == 'transcript')) {
    $field_name = 'data__protein_sequence';
    $field_type = 'data__protein_sequence';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );

    //     $field_name = 'so__cds';
    //     $field_type = 'so__cds';
    //     $info[$field_name] = array(
    //       'field_name' => $field_name,
    //       'type' => $field_type,
    //       'cardinality' => 1,
    //       'locked' => FALSE,
    //       'storage' => array(
    //         'type' => 'field_chado_storage',
    //       ),
    //     );
  }

  //   // GENE TRANSCRIPTS
  //   $rel_table = $table_name . '_relationship';
  //   if (chado_table_exists($rel_table) and $bundle->label == 'gene') {
  //     $field_name = 'so__transcript';
  //     $field_type = 'so__transcript';
  //     $info[$field_name] = array(
  //       'field_name' => $field_name,
  //       'type' => $field_type,
  //       'cardinality' => FIELD_CARDINALITY_UNLIMITED,
  //       'locked' => FALSE,
  //       'storage' => array(
  //         'type' => 'field_chado_storage',
  //       ),
  //     );
  //   }

  // ORGANISM TYPE_ID
  if ($table_name == 'organism' and array_key_exists('type_id', $schema['fields'])) {
    $field_name = 'taxrank__infraspecific_taxon';
    $field_type = 'taxrank__infraspecific_taxon';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // FEATUREMAP UNITTYPE_ID
  if ($table_name == 'featuremap') {
    $field_name = 'uo__unit';
    $field_type = 'uo__unit';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // Analysis source
  if ($table_name == 'analysis') {
    $field_name = 'local__source_data';
    $field_type = 'local__source_data';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  // Add an image field to the Organism type.  This is a Drupal field and
  // not stored in Chado, but is used for backwards compatibility.
  if ($table_name == 'organism') {
    $field_name = 'data__image';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => 'image',
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_sql_storage',
      ),
    );
  }

  // Add field for viewing the phylogenetic tree.
  if ($table_name == 'phylotree') {
    $field_name = 'operation__phylotree_vis';
    $field_type = 'operation__phylotree_vis';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

  //protocol
  if ($table_name == 'protocol' and array_key_exists('protocol_id', $schema['fields'])) {
    $field_name = 'sep__protocol';
    $field_type = 'sep__protocol';
    $info[$field_name] = array(
      'field_name' => $field_name,
      'type' => $field_type,
      'cardinality' => 1,
      'locked' => FALSE,
      'storage' => array(
        'type' => 'field_chado_storage',
      ),
    );
  }

}