3

I'm using the video and video embed field modules to display uploaded video and embedded youtube videos. I've added a video field and video_embed field to the video content type.

The user either uploads a video or embeds a video with the node. A custom form validation makes sure that either a video is uploaded or embedded. I have a template override for the video content tpl.php to hide an empty field on the node display page.

I'm using views to show various video previews. Both fields are added to the view and it shows up fine to the user. However, I'm getting a lot of "Unable to find the video thumbnail for ..." in the log. Those are errors when I have a youtube video embedded and nothing uploaded.

To come to the point: How can I suppress the video thumbnail from showing in the view when no video is provided. The "Hide if empty" no results setting isn't doing the trick here.

2

You could do this by creating a views row template for your view and then adding in logic to test whether or not a thumbnail exists. This also lets you style the row output differently so you don't have a gap where the image would have been.

Here's the handbook section on views theming:

http://drupal.org/node/352970

but your logic in the views template would be something like:

  if ($fields['field_<video thumbnail field name here>']->content) {
      <output image>
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.