function chado_add_node_form_dbxrefs_remove_button_submit

2.x tripal_core.chado_nodes.dbxrefs.api.inc chado_add_node_form_dbxrefs_remove_button_submit(&$form, &$form_state)

Remove the correct dbxref from the form Called by the many remove buttons in chado_add_node_form_dbxrefs

Related topics

1 call to chado_add_node_form_dbxrefs_remove_button_submit()
chado_add_node_form_subtables_remove_button_submit in tripal_core/api/tripal_core.chado_nodes.api.inc
Remove subtable entries to the node forms. Supported subtables: Properties, Relationships, Additional DBxrefs.

File

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

Code

function chado_add_node_form_dbxrefs_remove_button_submit(&$form, &$form_state) {

  // if the chado_additional_dbxrefs array is not set then this is the first time modifying the
  // dbxref table. this means we need to include all the dbxrefs from the db
  if (!isset($form_state['chado_additional_dbxrefs'])) {
    chado_add_node_form_dbxrefs_create_dbxref_formstate_array($form, $form_state);
  }

  // remove the specified dbxref from the form dbxref table
  if (preg_match('/dbxrefs_remove-([^-]+-[^-]+)/', $form_state['triggering_element']['#name'], $match)) {
    $key = $match[1];
    if (array_key_exists($key, $form_state['chado_additional_dbxrefs'])) {
      unset($form_state['chado_additional_dbxrefs'][$key]);
    }
  }
}