You are here

function webform_components_form_add_submit in Webform 7.4

Same name and namespace in other branches
  1. 6.3 includes/webform.components.inc \webform_components_form_add_submit()
  2. 7.3 includes/webform.components.inc \webform_components_form_add_submit()

Submit handler for webform_components_form() that adds a new component.

1 string reference to 'webform_components_form_add_submit'
webform_components_form in includes/webform.components.inc
The table-based listing of all components for this webform.

File

includes/webform.components.inc, line 365
Webform module component handling.

Code

function webform_components_form_add_submit($form, &$form_state) {
  $node = node_load($form_state['values']['nid']);
  $component = $form_state['values']['add'];

  // Set the values in the query string for the add component page.
  $query = array(
    'name' => $component['name'],
    'required' => $component['required'],
    'pid' => $component['pid'],
    'weight' => $component['weight'],
  );

  // Forward the "destination" query string value to the next form.
  if (isset($_GET['destination'])) {
    $query['destination'] = $_GET['destination'];
    unset($_GET['destination']);
    drupal_static_reset('drupal_get_destination');
  }
  $form_state['redirect'] = array(
    'node/' . $node->nid . '/webform/components/new/' . $component['type'],
    array(
      'query' => $query,
    ),
  );
}