summaryrefslogtreecommitdiff
path: root/modules/field_ui
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
parent89028a43bbbaf73e6aa1e8e00bc12d46d1fc7119 (diff)
downloadbrdo-b12d812b9397609a5853d8c2b73f29d282496fd9.tar.gz
brdo-b12d812b9397609a5853d8c2b73f29d282496fd9.tar.bz2
- Patch #665878 by yched: fixed field_extra_fields()
Diffstat (limited to 'modules/field_ui')
-rw-r--r--modules/field_ui/field_ui.admin.inc11
-rw-r--r--modules/field_ui/field_ui.module22
2 files changed, 19 insertions, 14 deletions
diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc
index 9143e99f4..c809adc4c 100644
--- a/modules/field_ui/field_ui.admin.inc
+++ b/modules/field_ui/field_ui.admin.inc
@@ -83,7 +83,7 @@ function field_ui_field_overview_form($form, &$form_state, $obj_type, $bundle) {
$field_types = field_info_field_types();
$widget_types = field_info_widget_types();
- $extra = field_extra_fields($bundle);
+ $extra = field_extra_fields($obj_type, $bundle);
// Store each default weight so that we can add the 'add new' rows after them.
$weights = array();
@@ -479,12 +479,9 @@ function field_ui_field_overview_form_submit($form, &$form_state) {
}
}
- if ($extra) {
- variable_set("field_extra_weights_$bundle", $extra);
- }
- else {
- variable_del("field_extra_weights_$bundle");
- }
+ $extra_weights = variable_get('field_extra_weights', array());
+ $extra_weights[$obj_type][$bundle] = $extra;
+ variable_set('field_extra_weights', $extra_weights);
$destinations = array();
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);
+ }
}
/**