function _drush_pm_sort_extensions

8.0.x pm.drush.inc _drush_pm_sort_extensions($a, $b)
6.x pm.drush.inc _drush_pm_sort_extensions($a, $b)
7.x pm.drush.inc _drush_pm_sort_extensions($a, $b)
4.x pm.drush.inc _drush_pm_sort_extensions($a, $b)
5.x pm.drush.inc _drush_pm_sort_extensions($a, $b)
master pm.drush.inc _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/pm.drush.inc
Command callback. Show a list of extensions with type and status.

File

commands/pm/pm.drush.inc, line 579
The drush Project Manager

Code

function _drush_pm_sort_extensions($a, $b) {
  $a_type = drush_extension_get_type($a);
  $b_type = drush_extension_get_type($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;
}