function theme_chado_add_node_form_dbxrefs_table

2.x tripal_core.chado_nodes.dbxrefs.api.inc theme_chado_add_node_form_dbxrefs_table($variables)

Function to theme the add/remove dbxrefs form into a table

Related topics

1 string reference to 'theme_chado_add_node_form_dbxrefs_table'
tripal_core_theme in tripal_core/tripal_core.module
Implements hook_theme(). Registers template files/functions used by this module.

File

tripal_core/api/tripal_core.chado_nodes.dbxrefs.api.inc, line 577
API to manage the chado _dbxref table for various Tripal Node Types

Code

function theme_chado_add_node_form_dbxrefs_table($variables) {
  $element = $variables['element'];

  $header = array(
    'db' => t('Database'),
    'dbxref_accession' => t('Accession'),
    'dbxref_version' => t('Version'),
    'dbxref_action' => t('Actions'),
  );

  $rows = array();
  foreach (element_children($element) as $db_id) {
    if ($db_id == 'new') {
      $row = array();

      $row['data'] = array();
      foreach ($header as $fieldname => $title) {
        $row['data'][] = drupal_render($element[$db_id][$fieldname]);
      }
      $rows[] = $row;
    }
    else {
      foreach (element_children($element[$db_id]) as $version) {
        $row = array();

        $row['data'] = array();
        $row['class'] = $element[$db_id][$version]['#attributes']['class'];
        foreach ($header as $fieldname => $title) {
          $row['data'][] = drupal_render($element[$db_id][$version][$fieldname]);
        }
        $rows[] = $row;
      }
    }
  }

  return render($element['save_warning']) . theme('table', array(
    'header' => $header,
    'rows' => $rows
  ));
}