bratsun
7/14/2014 - 3:48 PM

Audio player (field formatter export), add mediaplayer.js on theme level.

Audio player (field formatter export), add mediaplayer.js on theme level.

$('audio').mediaelementplayer({
  audioWidth: '100%',
  audioHeight: 30
});
$formatter = new stdClass();
$formatter->disabled = FALSE; /* Edit this to true to make a default formatter disabled initially */
$formatter->api_version = 2;
$formatter->name = 'audioplayer';
$formatter->label = 'Audio player';
$formatter->description = '';
$formatter->mode = 'php';
$formatter->field_types = 'file';
$formatter->code = '$output = \'\';
foreach ($variables[\'#items\'] as $key => $item) {
  $output .= \'<div class="audio-desc">\' . $item[\'description\'] . \'</div>\';
  $output .= \'<audio id="player- \' . $key . \'" src="\' . file_create_url($item[\'uri\']) . \'" type="audio/mp3" controls="controls"></audio>	\';
}
return $output;';
$formatter->fapi = '';