function ds_export_build in Display Suite 6.2
Same name and namespace in other branches
- 6.3 includes/ds.tools.inc \ds_export_build()
- 6 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 272 - 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 = array();
$records = db_query("SELECT * FROM {ds_settings} WHERE module = '%s' AND type = '%s'", $module, $type);
while ($row = db_fetch_object($records)) {
$settings[$row->build_mode] = unserialize($row->settings);
}
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;
}