W3cubDocs

/Drupal 8

function _update_project_status_sort

_update_project_status_sort($a, $b)

Orders projects based on their status.

Callback for uasort() within update_requirements().

File

core/modules/update/update.module, line 542
Handles updates of Drupal core and contributed projects.

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!update!update.module/function/_update_project_status_sort/8.1.x