You are here

function crossdomain_form_remove_one in Crossdomain 7

Submit handler for the "remove" button.

Decrements the max counter and causes a form rebuild.

1 string reference to 'crossdomain_form_remove_one'
crossdomain_form in ./crossdomain.admin.inc
Manages the domains for the crossdomain.xml file.

File

./crossdomain.admin.inc, line 104

Code

function crossdomain_form_remove_one($form, &$form_state) {

  // This is the id of the element to remove.
  $element_id = $form_state['clicked_button']['#parents'][2];
  if ($form_state['num_domains'] > 1) {
    $form_state['num_domains']--;
  }

  // Unset the values and reindex the variables.
  unset($form_state['values']['domains_fieldset']['element'][$element_id]);
  $form_state['values']['domains_fieldset']['element'] = array_values($form_state['values']['domains_fieldset']['element']);
  unset($form_state['input']['domains_fieldset']['element'][$element_id]);
  $form_state['input']['domains_fieldset']['element'] = array_values($form_state['input']['domains_fieldset']['element']);

  // Rebuild the form.
  $form_state['rebuild'] = TRUE;
}