function chado_add_node_form_subtables_remove_button_validate

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

Validate Removing Subtables entries from the node forms. Supported subtables: Properties, Relationships, Additional DBxrefs.

Since Removing isn't associated with any user input the only thing we need to validate is that Drupal has determined the triggering element correctly. That said, we will call each subtables associated validate function just incase there is some case-specific validation we do not know of or have not anticipated.

_state

Parameters

array $form:

3 string references to 'chado_add_node_form_subtables_remove_button_validate'
chado_add_node_form_dbxrefs in tripal_core/api/tripal_core.chado_nodes.dbxrefs.api.inc
Provides a form for adding to BASE_dbxref and dbxref tables
chado_add_node_form_properties in tripal_core/api/tripal_core.chado_nodes.properties.api.inc
chado_add_node_form_relationships in tripal_core/api/tripal_core.chado_nodes.relationships.api.inc
Provides a form for adding to BASE_relationship and relationship tables

File

tripal_core/api/tripal_core.chado_nodes.api.inc, line 242
API to handle much of the common functionality implemented when creating a drupal node type.

Code

function chado_add_node_form_subtables_remove_button_validate($form, &$form_state) {

  // We need to validate the trigerring element since Drupal has known
  // issues determining this correctly when there are multiple buttons
  // with the same label.
  chado_validate_node_form_triggering_element($form, $form_state);

  // Based on triggering element call the correct validation function
  // ASUMPTION #1: each of the buttons must have property, dbxref or relationship
  // as the first part of the #name to uniquely identify the subsection.
  if (preg_match('/^([a-z]+).*/', $form_state['triggering_element']['#name'], $matches)) {
    $subsection = $matches[1];

    switch ($subsection) {
      case 'properties':
        chado_add_node_form_properties_remove_button_validate($form, $form_state);
        break;
      case 'dbxrefs':
        chado_add_node_form_dbxrefs_remove_button_validate($form, $form_state);
        break;
      case 'relationships':
        chado_add_node_form_relationships_remove_button_validate($form, $form_state);
        break;
    }
  }
}