You are here

function jplayer_field_formatter_view in jPlayer 7.2

Implements hook_field_formatter_view().

File

./jplayer.module, line 120
Provides an HTML5-compatible with Flash-fallback audio player.

Code

function jplayer_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $element = array();
  switch ($display['type']) {
    case 'jplayer_player':
      if (!empty($items)) {
        $output = theme('jplayer', array(
          'entity_type' => $entity_type,
          'entity' => $entity,
          'field_name' => $instance['field_name'],
          'items' => $items,
          'settings' => $display['settings'],
        ));
      }
      else {
        return array();
      }
      $element[0] = array(
        '#markup' => $output,
      );
      break;
  }
  return $element;
}