summaryrefslogtreecommitdiff
path: root/modules/field_ui/field_ui.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-01-02 15:00:34 +0000
committerDries Buytaert <dries@buytaert.net>2010-01-02 15:00:34 +0000
commitb12d812b9397609a5853d8c2b73f29d282496fd9 (patch)
treecf6de6724ccba65a56aa3d73f6bf554ccc3c0313 /modules/field_ui/field_ui.module
parent89028a43bbbaf73e6aa1e8e00bc12d46d1fc7119 (diff)
downloadbrdo-b12d812b9397609a5853d8c2b73f29d282496fd9.tar.gz
brdo-b12d812b9397609a5853d8c2b73f29d282496fd9.tar.bz2
- Patch #665878 by yched: fixed field_extra_fields()
Diffstat (limited to 'modules/field_ui/field_ui.module')
-rw-r--r--modules/field_ui/field_ui.module22
1 files changed, 15 insertions, 7 deletions
diff --git a/modules/field_ui/field_ui.module b/modules/field_ui/field_ui.module
index b24ef7776..155849bce 100644
--- a/modules/field_ui/field_ui.module
+++ b/modules/field_ui/field_ui.module
@@ -248,7 +248,7 @@ function field_ui_field_ui_view_modes_tabs() {
/**
* Implements hook_field_attach_create_bundle().
*/
-function field_ui_field_attach_create_bundle($bundle) {
+function field_ui_field_attach_create_bundle($obj_type, $bundle) {
// When a new bundle is created, the menu needs to be rebuilt to add our
// menu item tabs.
variable_set('menu_rebuild_needed', TRUE);
@@ -257,18 +257,26 @@ function field_ui_field_attach_create_bundle($bundle) {
/**
* Implements hook_field_attach_rename_bundle().
*/
-function field_ui_field_attach_rename_bundle($bundle_old, $bundle_new) {
- if ($bundle_old !== $bundle_new && $extra = variable_get("field_extra_weights_$bundle_old", array())) {
- variable_set("field_extra_weights_$bundle_new", $extra);
- variable_del("field_extra_weights_$bundle_old");
+function field_ui_field_attach_rename_bundle($obj_type, $bundle_old, $bundle_new) {
+ if ($bundle_old !== $bundle_new) {
+ $extra_weights = variable_get('field_extra_weights', array());
+ if (isset($info[$obj_type][$bundle_old])) {
+ $extra_weights[$obj_type][$bundle_new] = $extra_weights[$obj_type][$bundle_old];
+ unset($extra_weights[$obj_type][$bundle_old]);
+ variable_set('field_extra_weights', $extra_weights);
+ }
}
}
/**
* Implements hook_field_attach_delete_bundle().
*/
-function field_ui_field_attach_delete_bundle($bundle) {
- variable_del('field_extra_weights_' . $bundle);
+function field_ui_field_attach_delete_bundle($obj_type, $bundle) {
+ $extra_weights = variable_get('field_extra_weights', array());
+ if (isset($extra_weights[$obj_type][$bundle])) {
+ unset($extra_weights[$obj_type][$bundle]);
+ variable_set('field_extra_weights', $extra_weights);
+ }
}
/**