function tripal_chado_bundle_fields_info

3.x tripal_chado.fields.inc tripal_chado_bundle_fields_info($entity_type, $bundle)

Implements hook_bundle_fields_info().

This is a Tripal defined hook that supports integration with the TripalEntity field.

File

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

Code

function tripal_chado_bundle_fields_info($entity_type, $bundle) {

  $chado_bundle = db_select('chado_bundle', 'cb')
    ->fields('cb')
    ->condition('bundle_id', $bundle->id)
    ->execute()
    ->fetchObject();

  // Get the details about the mapping of this bundle to the Chado table:
  $details = array(
    'chado_cvterm_id' => $chado_bundle->type_id,
    'chado_table' => $chado_bundle->data_table,
    'chado_type_table' => $chado_bundle->type_linker_table,
    'chado_type_column' => $chado_bundle->type_column,
    'chado_type_value' => $chado_bundle->type_value,
  );

  $info = array();

  // Create the fields for each column in the table.
  tripal_chado_bundle_fields_info_base($info, $details, $entity_type, $bundle);

  // Create custom fields.
  tripal_chado_bundle_fields_info_custom($info, $details, $entity_type, $bundle);

  // Create fields for linking tables.
  tripal_chado_bundle_fields_info_linker($info, $details, $entity_type, $bundle);

  return $info;

}