You are here

function swftools_wpaudio_swftools_preprocess_wpaudio in SWF Tools 6.3

Implementation of hook_swftools_preprocess_[player]().

File

wpaudio/swftools_wpaudio.module, line 61
Enables SWF Tools support for the WordPress Audio player.

Code

function swftools_wpaudio_swftools_preprocess_wpaudio(&$data) {

  // If the passed variables includes 'playlist_data' we have a playlist to use
  if ($data['othervars']['playlist_data']) {

    // Overwrite the file_url with the playlist string
    $data['othervars']['file_url'] = $data['othervars']['wpaudio']['soundFile'];
  }
  else {

    // Was a title set on this single element from CCK?
    if (isset($data['othervars']['title']) && $data['othervars']['title']) {
      $data['flashvars']['titles'] = $data['othervars']['title'];
    }
  }

  // Set the playerID the same as the container id
  $data['flashvars']['playerID'] = $data['othervars']['id'];

  // Retrieve default audio player settings
  $saved_settings = _swftools_wpaudio_flashvars($data['othervars']['profile']);

  // Combine user supplied values and defaults, letting user values dominate
  $data['flashvars'] = array_merge($saved_settings, $data['flashvars']);

  // Add accessible controls?
  if ($data['flashvars']['accessible']) {

    // Add the accessible markup to #suffix so it will be output after the player
    $data['othervars']['#suffix'] = theme('swftools_wpaudio_accessible', $data['othervars']['id'], $data['flashvars']['accessible']);

    // Unset the accessible parameters from flashvars so they are not output
    unset($data['flashvars']['accessible']);
  }

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

  // Add JavaScript to enable auto-close behavior and accessibility
  swftools_wpaudio_add_js();
}