function chado_add_node_form_properties_create_property_formstate_array

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

Creates an array in form_state containing the existing properties. This array is then modified by the add/remove buttons and used as a source for rebuilding the form. This function get's called at each button (add and remove) button submits the first time one of the button's is clicked to instantiates the $form_state['chado_properties'] array

$form_state['chado_properties'] = array( '[type_id]-[rank]' => array( 'type_id' => [the cvterm.cvterm_id value] 'type_name' => [the cvterm.name value] 'property_id' => [the property.property_id value, or NULL if it doesn't yet exist], 'value' => [the BASEprop.value value], 'rank' => [the BASEprop.rank value], ), );

Related topics

2 calls to chado_add_node_form_properties_create_property_formstate_array()
chado_add_node_form_properties_add_button_submit in tripal_core/api/tripal_core.chado_nodes.properties.api.inc
Called by the add button in chado_add_node_form_properties
chado_add_node_form_properties_remove_button_submit in tripal_core/api/tripal_core.chado_nodes.properties.api.inc
Remove the correct property from the form Called by the many remove buttons in chado_add_node_form_properties

File

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

Code

function chado_add_node_form_properties_create_property_formstate_array($form, &$form_state) {

  $form_state['chado_properties'] = array();

  foreach (element_children($form['properties']['property_table']) as $type_id) {
    if ($type_id != 'new') {
      foreach (element_children($form['properties']['property_table'][$type_id]) as $property_id) {
        $element = $form['properties']['property_table'][$type_id][$property_id];
        $property = array(
          'type_id' => $element['prop_type_id']['#value'],
          'type_name' => $element['type']['#markup'],
          'property_id' => $element['property_id']['#value'],
          'value' => $element['value']['#markup'],
          'rank' => $element['rank']['#markup']
        );
        $key = $property['type_id'] . '-' . $property['property_id'];
        $form_state['chado_properties'][$key] = (object) $property;
      }
    }
  }
}