function _drush_pm_sort_extensions

8.0.x _drush_pm_sort_extensions($a, $b)
6.x _drush_pm_sort_extensions($a, $b)
7.x _drush_pm_sort_extensions($a, $b)
4.x _drush_pm_sort_extensions($a, $b)
5.x _drush_pm_sort_extensions($a, $b)
master _drush_pm_sort_extensions($a, $b)

Sort callback function for sorting extensions.

It will sort first by type, second by package and third by name.

Related topics

1 string reference to '_drush_pm_sort_extensions'
drush_pm_list in commands/pm/
Command callback. Show a list of extensions with type and status.


commands/pm/, line 267
The drush Project Manager


function _drush_pm_sort_extensions($a, $b) {
  if ($a->type == 'module' && $b->type == 'theme') {
    return -1;
  if ($a->type == 'theme' && $b->type == 'module') {
    return 1;
  $cmp = strcasecmp($a->info['package'], $b->info['package']);
  if ($cmp == 0) {
    $cmp = strcasecmp($a->info['name'], $b->info['name']);
  return $cmp;