/** * Helper function for sorting blocks on admin/build/block. * * Active blocks are sorted by region, then by weight. * Disabled blocks are sorted by name. */function _block_compare($a, $b) { global $theme_key; static $regions; // We need the region list to correctly order by region. if (!isset($regions)) { $regions = array_flip(array_keys(system_region_list($theme_key))); $regions[BLOCK_REGION_NONE] = count($regions); } // Separate enabled from disabled. $status = $b['status'] - $a['status']; if ($status) { return $status; } // Sort by region (in the order defined by theme .info file). $place = $regions[$a['region']] - $regions[$b['region']]; if ($place) { return $place; } // Sort by weight. $weight = $a['weight'] - $b['weight']; if ($weight) { return $weight; } // Sort by title. return strcmp($a['info'], $b['info']);}