summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-11-22 10:53:20 +0000
committerDries Buytaert <dries@buytaert.net>2008-11-22 10:53:20 +0000
commitd7b65beea93f42f8974fb31c54f1c8687f0889a5 (patch)
tree8cc33e898fd98437df62b441b0c263ce6ed92c26 /modules
parentbbb38296e04616fc9885f913ada8e9bd10c52c74 (diff)
downloadbrdo-d7b65beea93f42f8974fb31c54f1c8687f0889a5.tar.gz
brdo-d7b65beea93f42f8974fb31c54f1c8687f0889a5.tar.bz2
- Patch #293370 by maartenvg, swentel, et al: block sorting fails if more than 20 blocks are present.
Diffstat (limited to 'modules')
-rw-r--r--modules/block/block.admin.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/block/block.admin.inc b/modules/block/block.admin.inc
index 505cc255a..645c2061c 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',