function field_ui_field_delete_form

Form constructor for removing a field instance from a bundle.

See also

field_ui_field_delete_form_submit()

Related topics

1 string reference to 'field_ui_field_delete_form'
field_ui_menu in modules/field_ui/field_ui.module
Implements hook_menu().

File

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

Code

function field_ui_field_delete_form($form, &$form_state, $instance) {
    $bundle = $instance['bundle'];
    $entity_type = $instance['entity_type'];
    $field = field_info_field($instance['field_name']);
    $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle);
    $form['entity_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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.