You are here

function _block_compare in Drupal 5

Same name and namespace in other branches
  1. 4 modules/block.module \_block_compare()
  2. 6 modules/block/block.admin.inc \_block_compare()
  3. 7 modules/block/block.admin.inc \_block_compare()

Helper function for sorting blocks on admin/build/block.

Active blocks are sorted by region, then by weight. Disabled blocks are sorted by name.

1 string reference to '_block_compare'
block_admin_display in modules/block/block.module
Generate main block administration form.

File

modules/block/block.module, line 260
Controls the boxes that are displayed around the main content.

Code

function _block_compare($a, $b) {
  $status = $b['status'] - $a['status'];

  // Separate enabled from disabled.
  if ($status) {
    return $status;
  }

  // Enabled blocks
  if ($a['status']) {
    $place = strcmp($a['region'], $b['region']);
    return $place ? $place : $a['weight'] - $b['weight'];
  }
  else {
    return strcmp($a['info'], $b['info']);
  }
}