function search_api_admin_element_compare in Search API 7
Sort callback sorting array elements by their "weight" key, if present.
See also
1 string reference to 'search_api_admin_element_compare'
- search_api_admin_index_workflow_submit in ./
search_api.admin.inc - Form submission handler for search_api_admin_index_workflow().
File
- ./
search_api.admin.inc, line 1807 - Administration page callbacks for the Search API module.
Code
function search_api_admin_element_compare($a, $b) {
$a_weight = is_array($a) && isset($a['weight']) ? $a['weight'] : 0;
$b_weight = is_array($b) && isset($b['weight']) ? $b['weight'] : 0;
if ($a_weight == $b_weight) {
return 0;
}
return $a_weight < $b_weight ? -1 : 1;
}