Mercurial > defr > drupal > core
comparison modules/block/block.module @ 5:2427550111ae 6.2
Drupal 6.2
author | Franck Deroche <webmaster@defr.org> |
---|---|
date | Tue, 23 Dec 2008 14:30:08 +0100 |
parents | c1f4ac30525a |
children | fff6d4c8c043 |
comparison
equal
deleted
inserted
replaced
4:d94886ac61a0 | 5:2427550111ae |
---|---|
1 <?php | 1 <?php |
2 // $Id: block.module,v 1.299 2008/02/03 19:12:57 goba Exp $ | 2 // $Id: block.module,v 1.299.2.2 2008/04/09 21:11:45 goba Exp $ |
3 | 3 |
4 /** | 4 /** |
5 * @file | 5 * @file |
6 * Controls the boxes that are displayed around the main content. | 6 * Controls the boxes that are displayed around the main content. |
7 */ | 7 */ |
130 'weight' => -10, | 130 'weight' => -10, |
131 ); | 131 ); |
132 $items['admin/build/block/list/js'] = array( | 132 $items['admin/build/block/list/js'] = array( |
133 'title' => 'JavaScript List Form', | 133 'title' => 'JavaScript List Form', |
134 'page callback' => 'block_admin_display_js', | 134 'page callback' => 'block_admin_display_js', |
135 'access arguments' => array('administer blocks'), | |
135 'type' => MENU_CALLBACK, | 136 'type' => MENU_CALLBACK, |
136 'file' => 'block.admin.inc', | 137 'file' => 'block.admin.inc', |
137 ); | 138 ); |
138 $items['admin/build/block/configure'] = array( | 139 $items['admin/build/block/configure'] = array( |
139 'title' => 'Configure block', | 140 'title' => 'Configure block', |
140 'page callback' => 'drupal_get_form', | 141 'page callback' => 'drupal_get_form', |
141 'page arguments' => array('block_admin_configure'), | 142 'page arguments' => array('block_admin_configure'), |
143 'access arguments' => array('administer blocks'), | |
142 'type' => MENU_CALLBACK, | 144 'type' => MENU_CALLBACK, |
143 'file' => 'block.admin.inc', | 145 'file' => 'block.admin.inc', |
144 ); | 146 ); |
145 $items['admin/build/block/delete'] = array( | 147 $items['admin/build/block/delete'] = array( |
146 'title' => 'Delete block', | 148 'title' => 'Delete block', |
147 'page callback' => 'drupal_get_form', | 149 'page callback' => 'drupal_get_form', |
148 'page arguments' => array('block_box_delete'), | 150 'page arguments' => array('block_box_delete'), |
151 'access arguments' => array('administer blocks'), | |
149 'type' => MENU_CALLBACK, | 152 'type' => MENU_CALLBACK, |
150 'file' => 'block.admin.inc', | 153 'file' => 'block.admin.inc', |
151 ); | 154 ); |
152 $items['admin/build/block/add'] = array( | 155 $items['admin/build/block/add'] = array( |
153 'title' => 'Add block', | 156 'title' => 'Add block', |
154 'page callback' => 'drupal_get_form', | 157 'page callback' => 'drupal_get_form', |
155 'page arguments' => array('block_add_block_form'), | 158 'page arguments' => array('block_add_block_form'), |
159 'access arguments' => array('administer blocks'), | |
156 'type' => MENU_LOCAL_TASK, | 160 'type' => MENU_LOCAL_TASK, |
157 'file' => 'block.admin.inc', | 161 'file' => 'block.admin.inc', |
158 ); | 162 ); |
159 $default = variable_get('theme_default', 'garland'); | 163 $default = variable_get('theme_default', 'garland'); |
160 foreach (list_themes() as $key => $theme) { | 164 foreach (list_themes() as $key => $theme) { |
437 } | 441 } |
438 } | 442 } |
439 else { | 443 else { |
440 $page_match = TRUE; | 444 $page_match = TRUE; |
441 } | 445 } |
442 | 446 $block->enabled = $enabled; |
443 if ($enabled && $page_match) { | 447 $block->page_match = $page_match; |
448 $blocks[$block->region]["{$block->module}_{$block->delta}"] = $block; | |
449 } | |
450 } | |
451 | |
452 // Create an empty array if there were no entries | |
453 if (!isset($blocks[$region])) { | |
454 $blocks[$region] = array(); | |
455 } | |
456 | |
457 foreach ($blocks[$region] as $key => $block) { | |
458 // Render the block content if it has not been created already. | |
459 if (!isset($block->content)) { | |
460 // Erase the block from the static array - we'll put it back if it has content. | |
461 unset($blocks[$region][$key]); | |
462 if ($block->enabled && $block->page_match) { | |
444 // Check the current throttle status and see if block should be displayed | 463 // Check the current throttle status and see if block should be displayed |
445 // based on server load. | 464 // based on server load. |
446 if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) { | 465 if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) { |
447 // Try fetching the block from cache. Block caching is not compatible with | 466 // Try fetching the block from cache. Block caching is not compatible with |
448 // node_access modules. We also preserve the submission of forms in blocks, | 467 // node_access modules. We also preserve the submission of forms in blocks, |
475 $blocks[$block->region]["{$block->module}_{$block->delta}"] = $block; | 494 $blocks[$block->region]["{$block->module}_{$block->delta}"] = $block; |
476 } | 495 } |
477 } | 496 } |
478 } | 497 } |
479 } | 498 } |
480 // Create an empty array if there were no entries | |
481 if (!isset($blocks[$region])) { | |
482 $blocks[$region] = array(); | |
483 } | |
484 return $blocks[$region]; | 499 return $blocks[$region]; |
485 } | 500 } |
486 | 501 |
487 /** | 502 /** |
488 * Assemble the cache_id to use for a given block. | 503 * Assemble the cache_id to use for a given block. |