You are here

block_upload.install in Block Upload 7

Same filename and directory in other branches
  1. 8 block_upload.install

Create the first block upload of many or convert it from the single block.

File

block_upload.install
View source
<?php

/**
 * @file
 * Create the first block upload of many or convert it from the single block.
 */

/**
 * Moves first block settings to multiple block structure.
 *
 * Don't forget to select block visibility settings manually.
 */
function block_upload_update_7100() {

  // Move field name.
  if ($block_field = variable_get('block_upload_field', '')) {
    variable_set('block_upload_1_field', $block_field);
    variable_del('block_upload_field');
  }

  // Move plupload setting.
  if ($plupload_status = variable_get('block_upload_plupload_status', 0)) {
    variable_set('block_upload_1_plupload_status', $plupload_status);
    variable_del('block_upload_plupload_status');
  }
}

/**
 * Moves block settings to single settings array.
 */
function block_upload_update_7101() {
  $blocks_count = variable_get('block_upload_blocks_count', 1);
  for ($i = 1; $i <= $blocks_count; $i++) {
    $settings = array();
    $plupload_status = variable_get('block_upload_' . $i . '_plupload_status', 0);
    $plupload_status ? $settings['plupload'] = TRUE : ($settings['plupload'] = FALSE);
    variable_set('block_upload_' . $i . '_settings', $settings);
  }
}

Functions

Namesort descending Description
block_upload_update_7100 Moves first block settings to multiple block structure.
block_upload_update_7101 Moves block settings to single settings array.