You are here

function webform_component_delete_form in Webform 5.2

Same name and namespace in other branches
  1. 6.3 includes/webform.components.inc \webform_component_delete_form()
  2. 6.2 webform_components.inc \webform_component_delete_form()
  3. 7.4 includes/webform.components.inc \webform_component_delete_form()
  4. 7.3 includes/webform.components.inc \webform_component_delete_form()
1 string reference to 'webform_component_delete_form'
webform_components in ./webform.module
Menu callback for node/[nid]/components.

File

./webform_components.inc, line 471
Webform module components handling.

Code

function webform_component_delete_form($node, $component) {
  $cid = $component['cid'];
  $form = array();
  $form['node'] = array(
    '#type' => 'value',
    '#value' => $node,
  );
  $form['component'] = array(
    '#type' => 'value',
    '#value' => $component,
  );
  if ($node->webform['components'][$cid]['type'] == 'fieldset') {
    $question = t('Delete the %name fieldset?', array(
      '%name' => $node->webform['components'][$cid]['name'],
    ));
    $description = t('This will immediately delete the %name fieldset and all children elements within %name from the %webform webform. This cannot be undone.', array(
      '%name' => $node->webform['components'][$cid]['name'],
      '%webform' => $node->title,
    ));
  }
  else {
    $question = t('Delete the %name component?', array(
      '%name' => $node->webform['components'][$cid]['name'],
    ));
    $description = t('This will immediately delete the %name component from the %webform webform. This cannot be undone.', array(
      '%name' => $node->webform['components'][$cid]['name'],
      '%webform' => $node->title,
    ));
  }
  return confirm_form($form, $question, 'node/' . $node->nid . '/edit/components', $description, t('Delete'));
}