You are here

function asset_bonus_asset_formatter in Asset 6

Same name in this branch
  1. 6 asset_bonus/asset_bonus.module \asset_bonus_asset_formatter()
  2. 6 contrib/asset_bonus/asset_bonus.module \asset_bonus_asset_formatter()
Same name and namespace in other branches
  1. 5.2 contrib/asset_bonus/asset_bonus.module \asset_bonus_asset_formatter()
  2. 5 asset_bonus/asset_bonus.module \asset_bonus_asset_formatter()

File

contrib/asset_bonus/asset_bonus.module, line 160

Code

function asset_bonus_asset_formatter($op = 'list', $asset = null, $attr = array()) {
  switch ($op) {
    case 'info':
      $formats['mp3player'] = array(
        'name' => 'mp3 Player',
        'types' => array(
          'local' => array(
            'mp3',
          ),
        ),
        'description' => t('Embed the mp3 file using the !1pixelout audio player', array(
          '!1pixelout' => l('1pixelout', 'http://www.1pixelout.net/code/audio-player-wordpress-plugin/'),
        )),
      );
      $formats['swfobject'] = array(
        'name' => 'swfobject',
        'types' => array(
          'local' => array(
            'swf',
            'flv',
          ),
        ),
        'description' => t('Embed the flash movie using the !swfobject javascript library', array(
          '!swfobject' => l('swfobject', 'http://blog.deconcept.com/swfobject/'),
        )),
      );
      return $formats;
    case 'init':

      //Moved init stuff to renderers to avoid unneeded loading
      break;
    case 'options':
    case 'preview':
    case 'details':
    case 'img':
      $function = 'asset_bonus_' . $attr['format'] . '_' . $op;
      if (function_exists($function)) {
        return call_user_func($function, $asset);
      }
      break;
    case 'render':
      $function = 'asset_bonus_' . $attr['format'];
      return theme($function, $asset, $attr);
  }
}