Would it be possible to add the image link functionality?

That way if you use, say, a thumbnail of the video in your node teaser mode, you can click on the thumbnail to open full article.

In other words, make it work like the regular Image field.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jenlampton’s picture

Assigned: Unassigned » jenlampton

Yep this seems reasonable, will add it :)

bcobin’s picture

First off, thank you SO much for this module! I spent all of yesterday struggling with Media, where the thumbnail won't link anywhere with the YouTube player and where the MediaFront player's fullscreen is problematic and, additionally, doesn't always work on iPhone. Arrgh.

This module does exactly what I need, simply and easily, with the exception of linking the thumbnail to the node, which also looks like it may be something "new" in Views (the "image linked to node" option doesn't seem to be available anymore.)

In any event, there's a relatively simple workaround for the thumbnail link to node if you create it via a view:

In my case, three fields:

1. Content: Title linked to node (default)

2. Content: YouTube video - exclude from display, Formatter: YouTube thumbnail. Image Style: your choice

3. Content: Link (Provide a simple link to the content) - Rewrite results - Rewrite the output of this field: checked, text=[field_youtube]

That's it! Seems to work like a charm.

Again, than you very much for this module - I can get back to work!

Tim Jones Toronto’s picture

Great module, thanks Jen.

Tested and confirmed #2 to provide image link using Views... nice rewrite solution.

Would be a good feature to include 'Format settings: YouTube thumbnail' on manage displays on teaser for non-Views users that provides a link to the full node and video.

Thanks again!

Marc-Antoine’s picture

Status: Active » Needs review
FileSize
4.09 KB

Hey. I wrote a patch for this, mostly inspired by the 'image' core module.

I hope you'll like this, you can now link your youtube thumbnail to it's original node or youtube page!

bcobin’s picture

Status: Needs review » Reviewed & tested by the community

@Marc-Antoine

Works like a charm - thanks much! :)

jenlampton’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for the patch!

Unfortunately, this doesn't seem to follow Drupal coding standards, so can't be committed as-is. The indenting is a little whacky, spaces are missing, and there seem to be tabs in the code. Please review the documentation on coding standards before creating your next patch.

jenlampton’s picture

Status: Needs work » Needs review
FileSize
3.82 KB

let's give this one a shot.

Marc-Antoine’s picture

Sorry about that Jen, but as you know sometime quick results get over standards especially in a Drupal's module since I often get few to no answer from the module's dev

Next time just ask and I'll fix my code, no problem.

If you have any questions or request about the patch, just say so and I'll try to help as best as I can.

Have a great day!

jenlampton’s picture

Thanks @Marc-Antoine,
Did you give the new patch a test? Does it work the same as yours? If so can you please change the status and I'll commit it! :)
Jen

guschilds’s picture

@jenlampton

I was getting errors and the patch wasn't working due to discrepancies between the use of 'link' and 'image_link'. I have conformed them all to 'image_link' in the attached patch. Linking a thumbnail to both content and YouTube from the field's display settings and from Views should now work appropriately.

@Marc-Antoine

Please note that this patch applies towards the latest 7.x-1.x branch rather than the -alpha2 download.

jenlampton’s picture

Status: Needs review » Needs work

I'm getting errors about the image_link variable now

Undefined index: image_link in theme_youtube_thumbnail() (line 106 of /Users/jlampton/Sites/_drupal/drupal-7.15/sites/youtube7.dev/modules/youtube/youtube.theme.inc).
jenlampton’s picture

Status: Needs work » Reviewed & tested by the community

Nope, I was wrong. I cleared the cache and everything seems to be fine. :) Thanks for the cleanup!

jenlampton’s picture

Status: Reviewed & tested by the community » Fixed

committed to the 7.x-1.x branch :)

misthero’s picture

Status: Fixed » Needs work

sorry i was following this and tried patch #10 but it's not working here, even clearing the cache the image does not link anywhere, not in teaser, or in views, checking the node with devel I see the youtube field array have just 2 elements

field_video (Array, 1 element)
    und (Array, 1 element)
        0 (Array, 2 elements)
            input (String, 42 characters ) http://www.youtube.com/watch?v=xxxxxxxx
            video_id (String, 11 characters ) xxxxxxxx

[image_link] is missing

jenlampton’s picture

Status: Needs work » Active

@misthero First, did you apply the patch to the 7.x-1.x branch of the module?

image_link is not part of the data, it's part of the display settings, so you should never see it as part of field_video.

A better way to check if it is being set is to put a dpm in theme_youtube_thumbnail on the $variables (you can do this either in either an override of this function in your theme's template.php file, or in the module itself). That's where you'll see the image_link setting.

function theme_youtube_thumbnail($variables) {
  dpm($variables);
  ...
}
guschilds’s picture

Status: Active » Needs work

@misthero

It is also worth noting that the image does not link by default. After selecting the 'YouTube thumbnail' format, did you further configure the format (by clicking the gear in 'manage display') to 'Link image to' either 'Content' or 'YouTube'? In Views, 'Link image to' defaults to 'Nothing' but should be changed to 'Content' or 'YouTube' for the specific field.

jenlampton’s picture

Status: Needs work » Fixed

I'm going to change this back to fixed since the change has been committed, and we can't determine if anything is actually wrong.
If we can confirm there is a problem then we can re-open.

misthero’s picture

Status: Fixed » Active

oddly enough it works now..

mmm.. yes, i configured it to link to 'Content' in Teaser and in a separated view block

... the error I was getting in watchdog was the same as #11 but clearing the cache is... was not doing any difference.

after flushing the cache again it worked.. sorry

and thank you for your reply :)

jenlampton’s picture

Status: Active » Fixed

Changing status back to fixed :)
Glad everything is working!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.