You are here

function audiofield_soundmanager2_buttonplayer in AudioField 7

Callback function for AudioField SoundManager2 Button player.

1 string reference to 'audiofield_soundmanager2_buttonplayer'
audiofield_players in ./audiofield.players.inc
Implements hook_audiofield_players().

File

./audiofield.players.inc, line 393
Declares the available audio players for the Audio Field module.

Code

function audiofield_soundmanager2_buttonplayer($player_path, $audio_file, $options) {
  $audio_title = $audio_file;
  if (!empty($options)) {
    if (!empty($options['item']['description'])) {
      $audio_title = $options['item']['description'];
    }
    elseif (!empty($options['item']['filename'])) {
      $audio_title = $options['item']['filename'];
    }
  }
  $player_base_path = variable_get('audiofield_players_dir', 'sites/all/libraries/player') . "/soundmanager2";
  drupal_add_js($player_base_path . '/script/soundmanager2.js', array(
    'weight' => 0,
  ));

  // Add Bar UI javascript.
  drupal_add_js($player_base_path . '/demo/mp3-player-button/script/mp3-player-button.js', array(
    'weight' => 1,
  ));

  // Add Bar UI style.
  drupal_add_css($player_base_path . '/demo/mp3-player-button/css/mp3-player-button.css');
  return theme('audiofield_players_soundmanager2_buttonplayer', array(
    'audio_file' => file_create_url($audio_file),
    'audio_title' => $audio_title,
  ));
}