Commit 336fef3d authored by catch's avatar catch

Issue #1211008 by yched: Split field_bundle_settings() out per bundle.

parent 551134fd
......@@ -1309,12 +1309,9 @@ function field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) {
field_cache_clear();
// Update bundle settings.
$settings = variable_get('field_bundle_settings', array());
if (isset($settings[$entity_type][$bundle_old])) {
$settings[$entity_type][$bundle_new] = $settings[$entity_type][$bundle_old];
unset($settings[$entity_type][$bundle_old]);
variable_set('field_bundle_settings', $settings);
}
$settings = variable_get('field_bundle_settings_' . $entity_type . '__' . $bundle_old, array());
variable_set('field_bundle_settings_' . $entity_type . '__' . $bundle_new, $settings);
variable_del('field_bundle_settings_' . $entity_type . '__' . $bundle_old);
// Let other modules act on renaming the bundle.
module_invoke_all('field_attach_rename_bundle', $entity_type, $bundle_old, $bundle_new);
......@@ -1348,11 +1345,7 @@ function field_attach_delete_bundle($entity_type, $bundle) {
field_cache_clear();
// Clear bundle display settings.
$settings = variable_get('field_bundle_settings', array());
if (isset($settings[$entity_type][$bundle])) {
unset($settings[$entity_type][$bundle]);
variable_set('field_bundle_settings', $settings);
}
variable_del('field_bundle_settings_' . $entity_type . '__' . $bundle);
// Let other modules act on deleting the bundle.
module_invoke_all('field_attach_delete_bundle', $entity_type, $bundle, $instances);
......
......@@ -610,16 +610,12 @@ function _field_sort_items_value_helper($a, $b) {
* If no $settings are passed, the current settings are returned.
*/
function field_bundle_settings($entity_type, $bundle, $settings = NULL) {
$stored_settings = variable_get('field_bundle_settings', array());
if (isset($settings)) {
$stored_settings[$entity_type][$bundle] = $settings;
variable_set('field_bundle_settings', $stored_settings);
variable_set('field_bundle_settings_' . $entity_type . '__' . $bundle, $settings);
field_info_cache_clear();
}
else {
$settings = isset($stored_settings[$entity_type][$bundle]) ? $stored_settings[$entity_type][$bundle] : array();
$settings = variable_get('field_bundle_settings_' . $entity_type . '__' . $bundle, array());
$settings += array(
'view_modes' => array(),
'extra_fields' => array(),
......
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