function constant_contact_sort_lists in Constant Contact 7.3
Same name and namespace in other branches
- 6.3 constant_contact.module \constant_contact_sort_lists()
Sort lists based on the user defined sort field.
1 string reference to 'constant_contact_sort_lists'
- constant_contact_get_lists in ./
constant_contact.module - Helper function to get contact lists.
File
- ./
constant_contact.module, line 1444
Code
function constant_contact_sort_lists($a, $b) {
$sort_field = variable_get('cc_contact_list_sort_order', CC_CONTACT_LIST_SORT_ORDER);
if ($sort_field == 'SortOrder' || $sort_field == 'id') {
if (!isset($a[$sort_field], $b[$sort_field]) || $a[$sort_field] == $b[$sort_field]) {
return 0;
}
return $a[$sort_field] < $b[$sort_field] ? -1 : 1;
}
elseif ($sort_field == 'Name') {
return strcmp($a[$sort_field], $b[$sort_field]);
}
}