Hi,

Indeed, we'll never enter in this statement because it is already catched previously...
But I have no idea on what should be really done :
is that user settings contains all default settings (obviously yes) ?
If true, this patch could be fine. If not, we need to merge settings anyway.

Files: 

Comments

Status:Active» Needs review
StatusFileSize
new532 bytes

Where is it previously cached? Not in that function anyways...

/**
* Prepare a block for rendering with theme('homebox_block').
*
* @param $block_key
*   A string identifying the block. Should match an array key in
*   $page->settings['blocks'], except for a user's custom block.
* @param $page
*   A homebox page object, as loaded by homebox_get_page().
*
* @return
*   A block object that can be passed to theme('homebox_block', $block).
*/
function homebox_prepare_block($block_key, $page) {
  global $user;
  // Load block settings.
  $user_settings = _homebox_get_user_settings($page);
  if ($user_settings !== FALSE && isset($user_settings[$block_key])) {
    // Custom blocks only exist in user settings.
    $block_settings = $user_settings[$block_key];
  }
  else {
    // Otherwise, start with the page defaults.
    $block_settings = $page->settings['blocks'][$block_key];
    if ($user_settings !== FALSE && isset($user_settings[$block_key])) {
      $block_settings = homebox_merge_settings($block_settings, $user_settings[$block_key]);
    }
  }
  $block_settings['key'] = $block_key;

Patch still applies nicely in git repo.