You are here

function swftools_update_6004 in SWF Tools 6.3

Updates the imagerotator variable to reflect the new storage format.

File

./swftools.install, line 245
Install, update and uninstall functions for the SWF Tools module.

Code

function swftools_update_6004() {

  // Initialise a results array
  $ret = array();

  // Get current values
  $defaults = variable_get('swftools_wijering_imagerotator', array());

  // If there are some values then update them
  if ($defaults) {

    // Initialise array for remapped defaults
    $new_defaults = array();

    // Process defaults to new format
    $new_defaults['basic']['height'] = $defaults['height'];
    $new_defaults['basic']['width'] = $defaults['width'];
    $new_defaults['color']['frontcolor'] = $defaults['frontcolor'];
    $new_defaults['color']['backcolor'] = $defaults['backcolor'];
    $new_defaults['color']['lightcolor'] = $defaults['lightcolor'];
    $new_defaults['appearance']['logo'] = $defaults['logo'];
    $new_defaults['appearance']['overstretch'] = $defaults['overstretch'];
    $new_defaults['appearance']['showicons'] = $defaults['showicons'];
    $new_defaults['appearance']['shownavigation'] = $defaults['shownavigation'];
    $new_defaults['appearance']['transition'] = $defaults['transition'];
    $new_defaults['playback']['rotatetime'] = $defaults['rotatetime'];
    $new_defaults['playback']['shuffle'] = $defaults['shuffle'];
    $new_defaults['interaction']['enablejs'] = $defaults['enablejs'];
    $new_defaults['interaction']['link'] = $defaults['link'];
    $new_defaults['interaction']['linkfromdisplay'] = $defaults['linkfromdisplay'];
    $new_defaults['interaction']['linktarget'] = $defaults['linktarget'];

    // Store new defaults
    variable_set('swftools_wijering_imagerotator', $new_defaults);

    // Set return message
    $ret = array(
      array(
        'success' => TRUE,
        'query' => 'Image rotator defaults remapped.',
      ),
    );
  }

  // Return results
  return $ret;
}