You are here

function swftools_onepixelout_swftools_preprocess_onepixelout in SWF Tools 6.3

Implementation of hook_swftools_preprocess_[player]().

File

onepixelout/swftools_onepixelout.module, line 85
Enables SWF Tools support for the original OnePixelOut player.

Code

function swftools_onepixelout_swftools_preprocess_onepixelout(&$data) {

  // Generate sequential player ids
  static $player_id = 1;

  // Assign a flashvar to identify the player - we add time as well, like swfobject2, to ensure truly unique ids
  $data['flashvars']['playerID'] = time() . $player_id++;

  // OnePixelOut needs a playerID, which can only be numeric, but it's easier if div and player had the same id
  // But then swfobject complains with numeric only ids, so we prepend swf, but keep numbers the same
  $data['othervars']['id'] = 'swf-' . $data['flashvars']['playerID'];

  // Retreive default onepixelout settings
  $saved_settings = _swftools_onepixelout_flashvars();

  // Combine user and admin defaults, overwriting defaults.
  $data['flashvars'] = array_merge($saved_settings, $data['flashvars']);

  // Attach file url of the content to display to flashvars
  $data['flashvars']['soundFile'] = $data['othervars']['file_url'];

  // Put auto-close script on the page
  swftools_onepixelout_add_js();
}