You are here

function ccl_blocks_update_7101 in Custom Contextual Links 7

Same name and namespace in other branches
  1. 8 ccl_blocks/ccl_blocks.install \ccl_blocks_update_7101()

Update the structure of block options to support multi select.

File

ccl_blocks/ccl_blocks.install, line 21
Provides install, upgrade and un-install functions for ccl_blocks.

Code

function ccl_blocks_update_7101() {
  $blocks = db_query("SELECT * FROM {ccl} WHERE type = :type", array(
    ':type' => 'block',
  ));
  foreach ($blocks as $block) {
    $options = unserialize($block->options);

    // No need in fixing the global blocks.
    if (!$options['block_global']) {
      $block_key = $options['block_select'];
      $options['block_select'] = array(
        $block_key => $block_key,
      );
      $block->options = serialize($options);
      drupal_write_record('ccl', $block, 'clid');
    }
  }
}