You are here

function conditional_fields_dependency_add_form_submit in Conditional Fields 7.3

Dependency add form submit.

See also

conditional_fields_dependency_add_form()

conditional_fields_dependency_add_form_validate()

File

includes/conditional_fields.admin.inc, line 300
Administration of dependencies.

Code

function conditional_fields_dependency_add_form_submit($form, &$form_state) {
  $options = array(
    'state' => $form_state['values']['state'],
    'condition' => $form_state['values']['condition'],
  );
  if (!($id = conditional_fields_dependency_insert($form_state['values']['dependee'], $form_state['values']['dependent'], $options))) {
    drupal_set_message(t('There was an error while trying to create the dependency.'), 'error');
    return;
  }
  $destination = drupal_get_destination();
  drupal_goto("admin/structure/dependencies/edit/{$id}", array(
    'query' => $destination,
  ));
}