function _update_project_status_sort

Same name in other branches
  1. 9 core/modules/update/update.module \_update_project_status_sort()
  2. 8.9.x core/modules/update/update.module \_update_project_status_sort()
  3. 10 core/modules/update/update.module \_update_project_status_sort()
  4. 11.x core/modules/update/update.module \_update_project_status_sort()

Orders projects based on their status.

Callback for uasort() within update_requirements().

1 string reference to '_update_project_status_sort'
update_requirements in modules/update/update.install
Implements hook_requirements().

File

modules/update/update.module, line 636

Code

function _update_project_status_sort($a, $b) {
    // The status constants are numerically in the right order, so we can
    // usually subtract the two to compare in the order we want. However,
    // negative status values should be treated as if they are huge, since we
    // always want them at the bottom of the list.
    $a_status = $a['status'] > 0 ? $a['status'] : -10 * $a['status'];
    $b_status = $b['status'] > 0 ? $b['status'] : -10 * $b['status'];
    return $a_status - $b_status;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.