drupal视图:如何为emfields调用swftools媒体播放器?
我正在使用 swftools 来显示文件字段(Drupal 6)。
现在我想使用 swftools 显示自定义 url emfields (嵌入媒体字段)。例如,如果我的 emaudio 字段包含 URL http://example.com/myaudio.mp3。我想使用 swftools 音频播放器来播放这个 mp3 文件。
如果我显示包含 emfield 的节点,我知道如何调用 swftools 播放器。我使用 hook_preprocess_content_field() 将 $items[0]['view'] 替换为 swf($items[0]['value']):
function mytheme_preprocess_content_field(&$vars) {
foreach ($vars['items']as $index=>$arr){
// Note:
// Emfield's custom_url video provider is called "zzz_custom_url".
// Emfield's custom_url audio provider is called "custom_url"
if ($arr['provider']=='zzz_custom_url' || $arr['provider']=='custom_url'){
$vars['items'][$index]['view'] = swf($arr['value']);
}
}
}
但如果我显示 view 包含 emfield。也就是说,当我显示视图而不是节点时,我无法弄清楚如何实现类似的技巧。有什么建议吗?
I am using swftools to display filefields (Drupal 6).
Now I would like to use swftools to display the custom-url emfields (embedded media fields). For example, if my emaudio field contains the url http://example.com/myaudio.mp3. I would like to use the swftools audio player to play this mp3 file.
I know how to invoke the swftools player, if I am displaying a node that contains an emfield. I use hook_preprocess_content_field() to replace $items[0]['view'] with swf($items[0]['value']):
function mytheme_preprocess_content_field(&$vars) {
foreach ($vars['items']as $index=>$arr){
// Note:
// Emfield's custom_url video provider is called "zzz_custom_url".
// Emfield's custom_url audio provider is called "custom_url"
if ($arr['provider']=='zzz_custom_url' || $arr['provider']=='custom_url'){
$vars['items'][$index]['view'] = swf($arr['value']);
}
}
}
But I do not know how to invoke the swf player if I am displaying a view that contains an emfield. That is, I have not been able to figure out how to pull off a similar trick when I am displaying a view rather than a node. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有一个解决方案。
我创建了一个视图模板来主题我的 emaudio 字段,
这是模板的内容:
I have a solution.
I created a views template to theme my emaudio field,
Here is the content of the template:
另一个解决方案:
创建自定义格式化程序“SWF Emaudio”,如下所述。然后选择此格式化程序以从 cck 或视图 UI 中显示您的自定义 url emaudio 字段。
Another solution:
Create the custom formatter "SWF Emaudio", as described below. Then select this formatter to display your custom-url emaudio field, from within the cck or views UI.