function field_tools_field_delete_form in Field tools 8
Same name and namespace in other branches
- 7 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'
- D7field_tools_menu in ./
field_tools.module - Implements hook_menu().
File
- ./
field_tools.admin.inc, line 485 - NOTICE: THIS FILE IS OBSOLETE. IT IS BEING KEPT UNTIL ALL FUNCTIONALITY IS PORTED TO DRUPAL 8.
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;
}