You are here

function form_builder_field_remove in Form Builder 6

Same name and namespace in other branches
  1. 7.2 includes/form_builder.admin.inc \form_builder_field_remove()
  2. 7 includes/form_builder.admin.inc \form_builder_field_remove()

Form for removing a field.

1 string reference to 'form_builder_field_remove'
form_builder_remove_page in includes/form_builder.admin.inc
Menu callback for removing a field.

File

includes/form_builder.admin.inc, line 744
form_builder.admin.inc Administrative interface for editing forms.

Code

function form_builder_field_remove($form_state, $form_type, $form_id, $element_id) {
  module_load_include('inc', 'form_builder', 'includes/form_builder.api');
  module_load_include('inc', 'form_builder', 'includes/form_builder.cache');
  $element = form_builder_cache_field_load($form_type, $form_id, $element_id);
  $form = array();
  $form['#form_type'] = $form_type;
  $form['#form_id'] = $form_id;
  $form['#element_id'] = $element_id;
  $question = t('Remove the field %title?', array(
    '%title' => $element['#title'],
  ));
  $path = isset($_GET['destination']) ? $_GET['destination'] : NULL;
  $description = t('Remove the field %title? This field will not be permanently removed until the form configuration is saved.', array(
    '%title' => isset($element['#title']) ? $element['#title'] : $element['#form_builder']['element_id'],
  ));
  $yes = t('Remove');
  return confirm_form($form, $question, $path, $description, $yes);
}