function asset_emfield_asset_formatter in Asset 5.2
Same name and namespace in other branches
- 6 contrib/asset_emfield/asset_emfield.module \asset_emfield_asset_formatter()
Implementation of hook_asset_formatter().
File
- contrib/
asset_emfield/ asset_emfield.module, line 78 - Asset Embedded Media Module
Code
function asset_emfield_asset_formatter($op = 'info', $asset = null, $attr = array()) {
$module_map = array(
'emfield_video' => 'video_cck',
);
$module = $module_map[$asset->type];
switch ($op) {
case 'info':
foreach ($module_map as $module) {
$cck_formats = module_invoke($module, 'field_formatter_info');
foreach ($cck_formats as $key => $cck_format) {
if ($key != 'default') {
$formats[$key] = array(
'name' => $cck_format['label'],
'description' => $cck_format['description'],
'module' => 'asset_emfield',
);
}
}
}
return $formats;
case 'load':
if ($asset->type == 'emfield_video') {
$formats = array();
$cck_formats = module_invoke($module, 'field_formatter_info');
foreach ($cck_formats as $key => $cck_format) {
if ($key != 'default') {
$formats[] = $key;
}
}
return $formats;
}
break;
case 'render':
return asset_emfield_invoke('render', $asset, $attr['format']);
case 'form':
// $function = 'asset_embed_'. $asset->embed['provider'] .'_'. $op;
// if (function_exists($function)) {
// return call_user_func($function, $asset, $attr);
// }
break;
}
}