field_ui_field_delete_form

Versions
mediamosa-21
field_ui_field_delete_form($form, &$form_state, $entity_type, $bundle, $field)

Menu callback; present a form for removing a field from a content type.

Code

modules/field_ui/field_ui.admin.inc, line 964

<?php
function field_ui_field_delete_form($form, &$form_state, $entity_type, $bundle, $field) {
  $bundle = field_extract_bundle($entity_type, $bundle);
  $instance = field_info_instance($entity_type, $field['field_name'], $bundle);
  $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle);

  $form['object_type'] = array('#type' => 'value', '#value' => $entity_type);
  $form['bundle'] = array('#type' => 'value', '#value' => $bundle);
  $form['field_name'] = array('#type' => 'value', '#value' => $field['field_name']);

  $output = confirm_form($form,
    t('Are you sure you want to delete the field %field?', array('%field' => $instance['label'])),
    $admin_path . '/fields',
    t('If you have any content left in this field, it will be lost. This action cannot be undone.'),
    t('Delete'), t('Cancel'),
    'confirm'
  );

  if ($field['locked']) {
    unset($output['actions']['submit']);
    $output['description']['#markup'] = t('This field is <strong>locked</strong> and cannot be deleted.');
  }

  return $output;
}
?>