function ds_features_revert in Display Suite 6.2
Same name and namespace in other branches
- 6.3 includes/ds.features.inc \ds_features_revert()
- 6 includes/ds.features.inc \ds_features_revert()
Implementation of hook_features_export_revert().
File
- includes/
ds.features.inc, line 109 - Features support.
Code
function ds_features_revert($module = NULL) {
// Display settings.
if ($display_settings = module_invoke($module, 'ds_default_settings')) {
foreach ($display_settings as $ds_module => $settings) {
foreach ($settings as $object_type => $setting) {
foreach ($setting as $build_mode => $conf) {
// Remove old settings.
db_query("DELETE FROM {ds_settings} WHERE build_mode = '%s' AND module = '%s' AND type = '%s'", $build_mode, $ds_module, $object_type);
// Catch situations where the feature name has crept into the table
db_query("DELETE FROM {ds_settings} WHERE build_mode = '%s' AND module = '%s' AND type = '%s'", $build_mode, $module, $object_type);
// Iterate over fields and ditch those which are hidden.
// This is for sites have upgraded but haven't re-exported their settings.
foreach ($conf['fields'] as $field_key => $field_value) {
if ($field_value['region'] == 'disabled') {
unset($conf['fields'][$field_key]);
}
}
// Save new settings.
$record = new stdClass();
$record->module = $ds_module;
$record->type = $object_type;
$record->build_mode = $build_mode;
$record->settings = serialize($conf);
drupal_write_record('ds_settings', $record);
}
}
}
}
}