drupal core updated to 7.28
This commit is contained in:
@@ -401,23 +401,27 @@ function _block_rehash($theme = NULL) {
|
||||
}
|
||||
// Save the blocks defined in code for alter context.
|
||||
$code_blocks = $current_blocks;
|
||||
$database_blocks = db_select('block', 'b')
|
||||
$database_blocks = db_select('block', 'b', array('fetch' => PDO::FETCH_ASSOC))
|
||||
->fields('b')
|
||||
->condition($or)
|
||||
->condition('theme', $theme)
|
||||
->execute();
|
||||
$original_database_blocks = array();
|
||||
foreach ($database_blocks as $block) {
|
||||
// Preserve info which is not in the database.
|
||||
$block->info = $current_blocks[$block->module][$block->delta]['info'];
|
||||
$module = $block['module'];
|
||||
$delta = $block['delta'];
|
||||
$original_database_blocks[$module][$delta] = $block;
|
||||
// The cache mode can only by set from hook_block_info(), so that has
|
||||
// precedence over the database's value.
|
||||
if (isset($current_blocks[$block->module][$block->delta]['cache'])) {
|
||||
$block->cache = $current_blocks[$block->module][$block->delta]['cache'];
|
||||
if (isset($current_blocks[$module][$delta]['cache'])) {
|
||||
$block['cache'] = $current_blocks[$module][$delta]['cache'];
|
||||
}
|
||||
// Preserve info which is not in the database.
|
||||
$block['info'] = $current_blocks[$module][$delta]['info'];
|
||||
// Blocks stored in the database override the blocks defined in code.
|
||||
$current_blocks[$block->module][$block->delta] = get_object_vars($block);
|
||||
$current_blocks[$module][$delta] = $block;
|
||||
// Preserve this block.
|
||||
$bids[$block->bid] = $block->bid;
|
||||
$bids[$block['bid']] = $block['bid'];
|
||||
}
|
||||
drupal_alter('block_info', $current_blocks, $theme, $code_blocks);
|
||||
foreach ($current_blocks as $module => $module_blocks) {
|
||||
@@ -456,7 +460,15 @@ function _block_rehash($theme = NULL) {
|
||||
else {
|
||||
$primary_keys = array();
|
||||
}
|
||||
drupal_write_record('block', $block, $primary_keys);
|
||||
// If the block is new or differs from the original database block, save
|
||||
// it. To determine whether there was a change it is enough to examine
|
||||
// the values for the keys in the original database record as that
|
||||
// contained every database field.
|
||||
if (!$primary_keys || array_diff_assoc($original_database_blocks[$module][$delta], $block)) {
|
||||
drupal_write_record('block', $block, $primary_keys);
|
||||
// Make it possible to test this.
|
||||
$block['saved'] = TRUE;
|
||||
}
|
||||
// Add to the list of blocks we return.
|
||||
$blocks[] = $block;
|
||||
}
|
||||
@@ -880,9 +892,11 @@ function _block_render_blocks($region_blocks) {
|
||||
else {
|
||||
$array = module_invoke($block->module, 'block_view', $block->delta);
|
||||
|
||||
// Valid PHP function names cannot contain hyphens.
|
||||
$delta = str_replace('-', '_', $block->delta);
|
||||
// Allow modules to modify the block before it is viewed, via either
|
||||
// hook_block_view_alter() or hook_block_view_MODULE_DELTA_alter().
|
||||
drupal_alter(array('block_view', "block_view_{$block->module}_{$block->delta}"), $array, $block);
|
||||
drupal_alter(array('block_view', "block_view_{$block->module}_{$delta}"), $array, $block);
|
||||
|
||||
if (isset($cid)) {
|
||||
cache_set($cid, $array, 'cache_block', CACHE_TEMPORARY);
|
||||
|
||||
Reference in New Issue
Block a user