function _field_features_export_sort in Features 7.2
Same name and namespace in other branches
- 7 includes/features.field.inc \_field_features_export_sort()
Helper to enforce consistency in field export arrays.
Parameters
array $field: Nested array containing field base and field instance configuration. In recursive calls, this is a nested element within that structure.
bool $sort: TRUE, if this (nested) element should be sorted.
See also
\_field_instance_features_export_sort()
1 call to _field_features_export_sort()
- field_features_export_render in includes/
features.field.inc - Implements hook_features_export_render().
File
- includes/
features.field.inc, line 503 - Features integration on behalf of 'field' module.
Code
function _field_features_export_sort(&$field, $sort = TRUE) {
// Some arrays are not sorted to preserve order (for example allowed_values).
static $sort_blacklist = array(
'allowed_values',
'format_handlers',
);
if ($sort) {
ksort($field);
}
foreach ($field as $k => $v) {
if (is_array($v)) {
_field_features_export_sort($field[$k], !in_array($k, $sort_blacklist));
}
}
}