function _views_weight_sort

Sorts a structured array by the 'weight' and then by 'title' element.

Callback for uasort() in views_fetch_base_tables().

Parameters

array $a: First item for comparison. The compared items should be associative arrays that include a 'weight' and title element.

array $b: Second item for comparison.

Return value

int -1 if the first item comes first, 1 if second and 0 if they have the same order.

1 string reference to '_views_weight_sort'
views_fetch_base_tables in drupal/core/modules/views/views.module
Fetch a list of all base tables available

File

drupal/core/modules/views/views.module, line 1269
Primarily Drupal hooks and global API functions to manipulate views.

Code

function _views_weight_sort($a, $b) {
  if ($a['weight'] != $b['weight']) {
    return $a['weight'] < $b['weight'] ? -1 : 1;
  }
  if ($a['title'] != $b['title']) {
    return $a['title'] < $b['title'] ? -1 : 1;
  }
  return 0;
}