Commit 9276cd74 authored by tim.plunkett's avatar tim.plunkett Committed by colan
Browse files

Issue #1571406 by DamienMcKenna, tim.plunkett: Don't use old field_bundle_settings variable.

parent 44851e00
......@@ -7,27 +7,18 @@
* not be overwritten.
*/
function content_migrate_install() {
$stored_settings = variable_get('field_bundle_settings', array());
// $stored_settings might be empty, set up the basic structure of the
// array to avoid errors.
if (empty($stored_settings) || !array_key_exists('node', $stored_settings)) {
$stored_settings['node'] = array();
}
foreach (node_type_get_names() as $type_name => $label) {
// This type name may not yet exist in the array, set it up.
if (!array_key_exists($type_name, $stored_settings['node'])) {
$stored_settings['node'][$type_name] = array(
$bundle_settings = field_bundle_settings('node', $type_name);
$bundle_settings += array(
'extra_fields' => array('form' => array(), 'display' => array()),
'view_modes' => array(),
);
}
$weights = variable_get('content_extra_weights_'. $type_name, array());
// If body has never been set in D6, it should be set to 0 to match the way D6 worked.
// The D7 core update may have set it to a value like -4.
if (empty($weights) || !array_key_exists('body_field', $weights)) {
$stored_settings['node'][$type_name]['extra_fields']['form']['body'] = array('weight' => 0);
$bundle_settings['extra_fields']['form']['body'] = array('weight' => 0);
}
// If a field name provided by a custom module has changed from D6 to D7,
......@@ -46,7 +37,7 @@ function content_migrate_install() {
$new_field = $field;
break;
}
$stored_settings['node'][$type_name]['extra_fields']['form'][$new_field] = array('weight' => $weight);
$bundle_settings['extra_fields']['form'][$new_field] = array('weight' => $weight);
}
// While we're here, update the body field with the right weight.
......@@ -59,7 +50,7 @@ function content_migrate_install() {
}
field_update_instance($instance);
}
field_bundle_settings('node', $type_name, $bundle_settings);
}
variable_set('field_bundle_settings', $stored_settings);
field_info_cache_clear();
}
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