You are here

ccl_blocks.install in Custom Contextual Links 7

Same filename and directory in other branches
  1. 8 ccl_blocks/ccl_blocks.install

Provides install, upgrade and un-install functions for ccl_blocks.

File

ccl_blocks/ccl_blocks.install
View source
<?php

/**
 * @file
 * Provides install, upgrade and un-install functions for ccl_blocks.
 */

/**
 * Implements hook_uninstall().
 *
 * Remove links created by the blocks submodule.
 */
function ccl_blocks_uninstall() {
  db_delete('ccl')
    ->condition('type', 'block')
    ->execute();
}

/**
 * Update the structure of block options to support multi select.
 */
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');
    }
  }
}

Functions

Namesort descending Description
ccl_blocks_uninstall Implements hook_uninstall().
ccl_blocks_update_7101 Update the structure of block options to support multi select.