Commit 8e50687d authored by Dries's avatar Dries

- Patch #441180 by bjaspan, yched: field_attach_delete_bundle() called...

- Patch #441180 by bjaspan, yched: field_attach_delete_bundle() called hook_field_attach_delete_bundle too soon.
parent 1c076bc8
......@@ -614,9 +614,13 @@ function hook_field_rename_bundle($bundle_old, $bundle_new) {
*
* This hook is invoked after the field module has performed the operation.
*
* See field_attach_delete_bundle() for details and arguments.
* @param $bundle
* The bundle that was just deleted.
* @param $instances
* An array of all instances that existed for $bundle before it was
* deleted.
*/
function hook_field_attach_delete_bundle($bundle) {
function hook_field_attach_delete_bundle($bundle, $instances) {
}
/**
......
......@@ -729,17 +729,17 @@ function _field_attach_rename_bundle($bundle_old, $bundle_new) {
* The bundle to delete.
*/
function _field_attach_delete_bundle($bundle) {
// Let other modules act on deleting the bundle
foreach (module_implements('field_attach_delete_bundle') as $module) {
$function = $module . '_field_attach_delete_bundle';
$function($bundle);
}
// Delete the instances themseves
$instances = field_info_instances($bundle);
foreach ($instances as $instance) {
field_delete_instance($instance['field_name'], $bundle);
}
// Let other modules act on deleting the bundle
foreach (module_implements('field_attach_delete_bundle') as $module) {
$function = $module . '_field_attach_delete_bundle';
$function($bundle, $instances);
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment