function chado_add_node_form_properties_add_button_submit

2.x tripal_core.chado_nodes.properties.api.inc chado_add_node_form_properties_add_button_submit($form, &$form_state)
3.x tripal_core.chado_nodes.properties.api.inc chado_add_node_form_properties_add_button_submit($form, &$form_state)

Called by the add button in chado_add_node_form_properties

Create an array of properties in the form state. This array will then be used to rebuild the form in subsequent builds

Related topics

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

File

tripal_core/api/tripal_core.chado_nodes.properties.api.inc, line 681
API to manage the chado prop table for various Tripal Node Types

Code

function chado_add_node_form_properties_add_button_submit($form, &$form_state) {

  $details = unserialize($form_state['values']['property_table']['details']);

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

  // get details for the new property
  $property = array(
    'type_id' => $form_state['values']['property_table']['new']['type'],
    'type_name' => $form_state['values']['property_table']['new']['type_name'],
    'definition' => $form_state['values']['property_table']['new']['definition'],
    'property_id' => 'TEMP' . uniqid(),
    'value' => $form_state['values']['property_table']['new']['value'],
    'rank' => 'TEMP' . uniqid(),
  );

  $key = $property['type_id'] . '-' . $property['property_id'];
  $form_state['chado_properties'][$key] = (object) $property;

  // we don't want the new element to pick up the values from the previous element so wipe them out
  unset($form_state['input']['property_table']['new']['type']);
  unset($form_state['input']['property_table']['new']['type_name']);
  unset($form_state['input']['property_table']['new']['definition']);
  unset($form_state['input']['property_table']['new']['value']);

}