comparison modules/block/block.admin.inc @ 15:4347c45bb494 6.7

Drupal 6.7
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:32:44 +0100
parents 8b6c45761e01
children
comparison
equal deleted inserted replaced
14:626fcabfa4b8 15:4347c45bb494
1 <?php 1 <?php
2 // $Id: block.admin.inc,v 1.14.2.3 2008/10/20 13:02:29 dries Exp $ 2 // $Id: block.admin.inc,v 1.14.2.5 2008/11/24 06:00:02 dries Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * Admin page callbacks for the block module. 6 * Admin page callbacks for the block module.
7 */ 7 */
36 init_theme(); 36 init_theme();
37 37
38 $throttle = module_exists('throttle'); 38 $throttle = module_exists('throttle');
39 $block_regions = system_region_list($theme_key) + array(BLOCK_REGION_NONE => '<'. t('none') .'>'); 39 $block_regions = system_region_list($theme_key) + array(BLOCK_REGION_NONE => '<'. t('none') .'>');
40 40
41 // Weights range from -delta to +delta, so delta should be at least half
42 // of the amount of blocks present. This makes sure all blocks in the same
43 // region get an unique weight.
44 $weight_delta = round(count($blocks) / 2);
45
41 // Build form tree 46 // Build form tree
42 $form = array( 47 $form = array(
43 '#action' => arg(3) ? url('admin/build/block/list/'. $theme_key) : url('admin/build/block'), 48 '#action' => arg(4) ? url('admin/build/block/list/'. $theme_key) : url('admin/build/block'),
44 '#tree' => TRUE, 49 '#tree' => TRUE,
45 ); 50 );
46 51
47 foreach ($blocks as $i => $block) { 52 foreach ($blocks as $i => $block) {
48 $key = $block['module'] .'_'. $block['delta']; 53 $key = $block['module'] .'_'. $block['delta'];
62 '#value' => $theme_key 67 '#value' => $theme_key
63 ); 68 );
64 $form[$key]['weight'] = array( 69 $form[$key]['weight'] = array(
65 '#type' => 'weight', 70 '#type' => 'weight',
66 '#default_value' => $block['weight'], 71 '#default_value' => $block['weight'],
72 '#delta' => $weight_delta,
67 ); 73 );
68 $form[$key]['region'] = array( 74 $form[$key]['region'] = array(
69 '#type' => 'select', 75 '#type' => 'select',
70 '#default_value' => $block['region'], 76 '#default_value' => $block['region'],
71 '#options' => $block_regions, 77 '#options' => $block_regions,