From d7b65beea93f42f8974fb31c54f1c8687f0889a5 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Sat, 22 Nov 2008 10:53:20 +0000 Subject: [PATCH] - Patch #293370 by maartenvg, swentel, et al: block sorting fails if more than 20 blocks are present. --- modules/block/block.admin.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc index 505cc255afd5..645c2061c5a5 100644 --- a/modules/block/block.admin.inc +++ b/modules/block/block.admin.inc @@ -36,6 +36,11 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) { $block_regions = system_region_list($theme_key) + array(BLOCK_REGION_NONE => '<' . t('none') . '>'); + // Weights range from -delta to +delta, so delta should be at least half + // of the amount of blocks present. This makes sure all blocks in the same + // region get an unique weight. + $weight_delta = round(count($blocks) / 2); + // Build the form tree. $form = array( '#action' => arg(4) ? url('admin/build/block/list/' . $theme_key) : url('admin/build/block'), @@ -62,6 +67,7 @@ function block_admin_display_form(&$form_state, $blocks, $theme = NULL) { $form[$key]['weight'] = array( '#type' => 'weight', '#default_value' => $block['weight'], + '#delta' => $weight_delta, ); $form[$key]['region'] = array( '#type' => 'select', -- GitLab