function field_tools_field_delete_form in Field tools 7
Same name and namespace in other branches
- 8 field_tools.admin.inc \field_tools_field_delete_form()
Form for deleting multiple instances of a field.
1 string reference to 'field_tools_field_delete_form'
- field_tools_menu in ./
field_tools.module - Implements hook_menu().
File
- ./
field_tools.admin.inc, line 484 - Contains admin callbacks for the Field tools module.
Code
function field_tools_field_delete_form($form, &$form_state, $field) {
drupal_set_title(t('Delete instances from field %fieldname', array(
'%fieldname' => $field['field_name'],
)), PASS_THROUGH);
$form['info'] = array(
'#markup' => $field['field_name'],
);
$entity_info = entity_get_info();
$options = array();
foreach ($field['bundles'] as $entity_type => $bundles) {
foreach ($bundles as $bundle) {
$options["{$entity_type}:{$bundle}"] = $entity_info[$entity_type]['label'] . ': ' . $entity_info[$entity_type]['bundles'][$bundle]['label'];
}
}
$form['instances'] = array(
'#type' => 'checkboxes',
'#title' => t('Instances to delete'),
'#description' => t("WARNING: deleting an instance will delete ALL THE DATA in that instance."),
'#options' => $options,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Delete field instances'),
);
// @todo: use confirm_form()!
return $form;
}