function _ds_sort_fields in Display Suite 7.2
Same name and namespace in other branches
- 8.4 includes/field_ui.inc \_ds_sort_fields()
- 8.2 includes/field_ui.inc \_ds_sort_fields()
- 8.3 includes/field_ui.inc \_ds_sort_fields()
- 7 ds.field_ui.inc \_ds_sort_fields()
Utility function to sort a multidimensional array by a value in a sub-array.
Parameters
$a: The array to sort.
$subkey: The subkey to sort by.
1 call to _ds_sort_fields()
- ds_field_ui_layouts_save in includes/
ds.field_ui.inc - Save the layout settings from the 'Manage display' screen.
File
- includes/
ds.field_ui.inc, line 2631 - Field UI functions for Display Suite.
Code
function _ds_sort_fields($a, $subkey) {
foreach ($a as $k => $v) {
if (isset($v[$subkey])) {
$b[$k] = $v[$subkey];
}
}
asort($b);
foreach ($b as $key => $val) {
$c[$key] = $a[$key];
}
return $c;
}