function globallink_form_field_ui_field_delete_form_submit in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink.module \globallink_form_field_ui_field_delete_form_submit()
- 7.6 globallink.module \globallink_form_field_ui_field_delete_form_submit()
Submit handler for delete link on Manage Fields Page of Content Type and Field Collection. This deletes a field from fields config table.
1 string reference to 'globallink_form_field_ui_field_delete_form_submit'
File
- ./
globallink.module, line 108 - GlobalLink translation module.
Code
function globallink_form_field_ui_field_delete_form_submit($form, &$form_state) {
$entity_type = isset($form['entity_type']['#value']) ? $form['entity_type']['#value'] : FALSE;
$bundle_name = isset($form['bundle']['#value']) ? $form['bundle']['#value'] : FALSE;
$field_name = isset($form['field_name']['#value']) ? $form['field_name']['#value'] : FALSE;
if (!$entity_type) {
return;
}
switch ($entity_type) {
case GLOBALLINK_ENTITY_TYPE_NODE:
// Request coming from Manage Fields of Content Type.
$field_info = field_info_field($field_name);
switch ($field_info['type']) {
case 'list_boolean':
case 'list_integer':
case 'file':
case 'taxonomy_term_reference':
break;
case 'field_collection':
// field-collection being deleted, delete all fields recursively for this content type only.
globallink_delete_fc($bundle_name, $field_name, $entity_type, $bundle_name);
break;
default:
// Regular field, just delete from the config.
db_delete('globallink_field_config')
->condition('content_type', $bundle_name, ' = ')
->condition('entity_type', $entity_type, ' = ')
->condition('bundle', $bundle_name, ' = ')
->condition('field_name', $field_name, ' = ')
->execute();
break;
}
break;
case 'field_collection_item':
// Request coming from Manage Fields of Field Collections
// Entity type for all the fields here will be field_collection_item.
$field_info = field_info_field($field_name);
switch ($field_info['type']) {
case 'list_boolean':
case 'image':
case 'file':
case 'taxonomy_term_reference':
break;
case 'field_collection':
// Field-collection being deleted, delete all fields recursively for all the content types.
$content_types = globallink_get_all_content_types_for_field($bundle_name, 'field_collection');
foreach ($content_types as $content_type) {
globallink_delete_fc($content_type, $field_name, $entity_type, $bundle_name);
}
break;
default:
// Regular field-collection field, just delete from the config for all content types.
$content_types = globallink_get_all_content_types_for_field($bundle_name, 'field_collection');
foreach ($content_types as $content_type) {
db_delete('globallink_field_config')
->condition('content_type', $content_type, ' = ')
->condition('entity_type', $entity_type, ' = ')
->condition('bundle', $bundle_name, ' = ')
->condition('field_name', $field_name, ' = ')
->execute();
}
}
break;
}
}