function ds_export_build in Display Suite 6
Same name and namespace in other branches
- 6.3 includes/ds.tools.inc \ds_export_build()
- 6.2 includes/ds.tools.inc \ds_export_build()
Build the export variable.
2 calls to ds_export_build()
- ds_export in includes/
ds.tools.inc - Export functionality.
- ds_features_export_render in includes/
ds.features.inc - Implementation of hook_features_export_render().
File
- includes/
ds.tools.inc, line 253 - Tools for Display suite like export & import.
Code
function ds_export_build($values) {
$return = array();
foreach ($values as $otype => $value) {
if ($otype === $value) {
list($module, $type) = explode('-', $value);
// Display settings.
$settings = variable_get($module . '_display_settings_' . $type, array());
if (!empty($settings)) {
foreach ($settings as $build_mode => $setting) {
$settings[$build_mode]['status'] = DS_SETTINGS_DEFAULT;
}
$return['ds']['settings'][$module][$type] = $settings;
}
// Fields.
$fields = variable_get($module . '_fields', array());
if (!empty($fields)) {
// We don't export overridden fields, unset them if necessary.
foreach ($fields as $key => $field) {
if ($field['status'] == DS_FIELD_STATUS_OVERRIDDEN) {
unset($fields[$key]);
$return['exclude']['fields'][] = $field['title'];
}
elseif ($field['status'] == DS_FIELD_STATUS_CUSTOM) {
$fields[$key]['status'] = DS_FIELD_STATUS_DEFAULT;
}
}
if (!empty($fields)) {
$return['ds']['fields'][$module] = $fields;
}
}
}
}
return $return;
}