You are here

function form_builder_field_remove in Form Builder 7

Same name and namespace in other branches
  1. 6 includes/form_builder.admin.inc \form_builder_field_remove()
  2. 7.2 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 677
form_builder.admin.inc Administrative interface for editing forms.

Code

function form_builder_field_remove($form, $form_state, $form_type, $form_id, $element_id) {
  $form_obj = FormBuilderLoader::instance()
    ->fromCache($form_type, $form_id);
  $element_obj = $form_obj
    ->getElement($element_id);
  $title = $element_obj
    ->title();
  $question = t('Remove the field %title?', array(
    '%title' => $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' => $title,
  ));
  $yes = t('Remove');
  if ($_REQUEST['js']) {
    $form['js'] = array(
      '#type' => 'hidden',
      '#value' => '1',
    );
  }
  return confirm_form($form, $question, $path, $description, $yes);
}