function _block_compare in Drupal 4
Same name and namespace in other branches
- 5 modules/block/block.module \_block_compare()
- 6 modules/block/block.admin.inc \_block_compare()
- 7 modules/block/block.admin.inc \_block_compare()
Helper function for sorting blocks on admin/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.module - Generate main block administration form.
File
- modules/
block.module, line 254 - 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']);
}
}