You are here

function _front_page_sort in Front Page 7.2

Sort by weight ASC and rid DESC.

2 string references to '_front_page_sort'
front_page_get_all in ./front_page.module
Function to return all the roles in front page, ordered by weight.
front_page_get_by_role in ./front_page.module
Function to return the first role enabled in front page, ordered by weight.

File

./front_page.module, line 309

Code

function _front_page_sort($a, $b) {
  $a_value = is_array($a) && isset($a['weight']) ? $a['weight'] : 0;
  $b_value = is_array($b) && isset($b['weight']) ? $b['weight'] : 0;
  if ($a_value != $b_value) {
    return $a_value < $b_value ? -1 : 1;
  }
  $a_value = is_array($a) && isset($a['rid']) ? $a['rid'] : 0;
  $b_value = is_array($b) && isset($b['rid']) ? $b['rid'] : 0;
  if ($a_value != $b_value) {
    return $a_value > $b_value ? -1 : 1;
  }
  return 0;
}